Java has two major data types
- Primitive
- Reference
Primitive Data Type
Since the java programs has to run on different platforms and architectures, it has to maintain the size of data as constant so that the output is same on all platforms
Example: Int, float etc
Primitive Data Types and memory allocation
| Integer Data Type | Byte | 8 Bit |
| Short | 16 Bit | |
| Int | 32 Bit | |
| Long | 64 Bit | |
| Real Numbers | Float | 32 Bit |
| Double | 64 Bit | |
| Other Data Types | Char | 16 Bit |
| Booleran | true/false |
Reference Data Types
All objects which we use in programming are of reference Data type. Java don’t provide direct access to these data types. These reference data type are accessed by pointers
Example: String, Array, Objects, Interfaces etc
Memory Management can be handled by JVM itself