Java is strongly typed language. Indeed, part of the Java's safety and robustness comes from this fact.
First, every variable and expression has a type, and every type is strictly defined. Second, all the assignments, whether explicit or via the parameter passing in the method calls, are checked for the type compatibility. There are no automatic conversions of infringing types as in some languages. The Java compiler checks all the expressions and parameters to ensure that the type are compatible. Any type mismatches are errors that must be corrected before the compiler will finish compiling the class.
Java defines the following eight primitive data types:
The primitive data types are also commonly referred to as simple types. These can be put in the following four groups :
You can use these types as is, or to construct the arrays or your own class types. Therefore, they form the basis of all the other types of data that you can create.
© Copyright 2021. All Rights Reserved.