As explained in the previous chapter, a variable in Java must be a specified data type:
Example
int myNum = 5;               // Integer (whole number)
float myFloatNum = 5.99f;    // Floating point number
char myLetter = 'D';         // Character
boolean myBool = true;       // Boolean
String myText = "Hello";     // String
Data types are divided into two groups:
- Primitive data types - includes 
byte,short,int,long,float,double,booleanandchar - Non-primitive data types - such as String, Arrays and Classes (you will learn more about these in a later chapter)
 
Practice Excercise Practice now