Variables are containers for storing data values.
In Java, there are different types of variables, for example:
1) String – stores text, such as “Hello Techlearn“. String values are surrounded by Double Quotes.
2) int – stores integers (whole numbers), without decimals, such as 12345 or -12345
3) float – stores floating point numbers, with decimals, such as 18.55 or -18.55
4) char – stores single characters, such as ‘a’ or ‘B‘. Char values are surrounded by Single Quotes
5) boolean – stores values with two states: true or false
Note:
String is Class
int, float, char, boolean are keywords.