Java Data Types
Java is a Strongly Typed Language
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 Primitive Data Types
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 :
- Integers - This group included byte, short, int, and long, which are for whole-valued signed numbers.
- Floating-Point numbers - This group includes float and double, these represent the numbers with fractional precision.
- Characters - This group includes char, which represents the symbols in a character set, like letters and numbers.
- Booleans - This group includes boolean, which is a special type for representing the true/false values.
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.
« Previous Tutorial Next Tutorial »
Follow/Like Us on Facebook
Subscribe Us on YouTube