The Simple Types
Java describes eight simple (or elemental) categories of data: byte, short int, long, char, floats, Double, and Boolean. These could be put in four groups.
- Integers This group involves Byte, short, int and long, that are for whole valued singed numbers.
- Floating point numbers This group involves float and double that represent numbers along with fractional precision.
- Characters This group includes char that represents symbols in a character set, such as letters and numbers.
- Boolean This group involves boolean, that is a special type for representing true/false values.
You can use these types as-is, or to construct arrays your own class types. Therefore, they form the basis for all other types of data which you can create.
A simple type represents single values not complex objects. While Java is or else completely OOPs, the simple types are not. They are analogous to the simple categories found in most other non-object-oriented language. The reason for this is effectiveness. Making the simple types into objects would have degraded performance too much.
The simple types are described to have an explicit range and mathematical behavior. Languages like as C and C++ permit the size of an integer to vary based upon the dictates of the execution environment. Moreover, Java is different. Since of Java's portability needs, all data types have a strictly defined range. For instance, an int is always 32 bits, anyway the particular platform. This permits programs to be written which are guaranteed to run without porting on any machine architecture. Although environments, it is necessary in order to achieve portability.