-The java has Two Type of Data Types.These Are
- Primitive Data Types
- Non-Primitive Data Types
- Primitive Data Types: (IT Has Eight Types)
byte - Stores small integers from -128 to 127(1 byte).
Used only when memory optimization actually matters.short - Stores integers from -32,768 to 32,767(2 bytes).
Almost never used in real Java applications.int - Stores whole numbers within 32-bit range(4 Bytes).
Default and most commonly used integer type.long - Stores very large whole numbers (64-bit)(8 Bytes).
Use when int is not sufficient.float - Stores decimal numbers with single precision().
Not accurate for financial or precise calculations.double - Stores decimal numbers with double precision.
Default choice for decimal values in Java.char - Stores a single Unicode character.
Uses 2 bytes and supports international characters.boolean - Stores only true or false.
Used for conditions and logical decisions.
-Non -Primitive Data Types:
String - Stores a sequence of characters as an object.
Immutable and provides many built-in methods.Array - Stores multiple values of the same type.
Size is fixed once created.Class - Blueprint used to create objects.
Contains variables and methods together.Object - Instance of a class stored in heap memory.
Accessed using reference variables.Interface - Defines method declarations without implementation.
Used to achieve abstraction and multiple inheritance.Enum - Stores a fixed set of named constants.
Used for predefined, unchangeable values

Top comments (0)