Explanatory Question
What is a datatype?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
A datatype defines what kind of data a variable can hold in Java.
Example:
int age = 25; // age can store integer values double salary = 5000.50; // salary can store decimal values char grade = 'A'; // grade stores a single character boolean isPassed = true; // stores true/false
Java datatypes are mainly two categories:
Primitive types → int, double, boolean, char, byte, short, long, float
Reference types → classes, arrays, interfaces, enums, etc.
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.