Abstract
As we have learned at the beginning of this book in Part I, the Java programming language has defined the integer, double, Boolean, String, etc., as basic types. In Java, we cannot assign any value to a variable without defining the variable with a type beforehand. Only after a variable has been defined clearly by a type—for example, integer—are we then allowed to assign an integer value to it and start using it as an integer in the calculation. Once a variable's type is defined, it cannot be assigned a value with a different type, logically speaking. For instance, if a variable is defined as Boolean, it cannot be assigned an integer value. Otherwise, we will get a type mismatch compilation error.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Ron Dai
About this chapter
Cite this chapter
Dai, R. (2019). Strong Typed Programming. In: Learn Java with Math. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5209-3_17
Download citation
DOI: https://doi.org/10.1007/978-1-4842-5209-3_17
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-5208-6
Online ISBN: 978-1-4842-5209-3
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)