Variables
int myNum = 15;
int myNum2; // do not assign, then assign
myNum2 = 15;
int myNum3 = 15; // myNum3 is 15
myNum3 = 10; // myNum3 is now 10
float myFloat = 5.99; // floating point number
char myLetter = 'D'; // character
int x = 5;
int y = 6;
int sum = x + y; // add variables to sum
// declare multiple variables
int x = 5, y = 6, z = 50;
Comments