Variables

 Primitive Types:

Type – A kind of data that can be stored. There are two major kinds in java: Primitive types and Objects.
Type Contains Default Size
boolean True or False False 1 bit
char One Character \u0000 16 bits
byte Integer 0 8 bits
short Integer 0 16 bits
int Integer 0 32 bits
long Integer 0 64 bits
float Decimal 0.0 32 bits
double Decimal 0.0 64 bits
String words null string -
We will mostly use Boolean, char, int and double.

Declaring A Primitive Type:

         int a;
         char c;
         string x;

Initializing A Primitive Type:

         int a = 0;
         char c = ‘h’; //single quotes for char
         String x = “I love programming”; //double quotes for string

Assignment Statements:

         a = 9;
         d = a+4;
         x = IBIO.inputString (“Please enter your name:”);