// This class is meant to be a demonstration for declaring and assigning values to variables class TestVar { public static void main (String [] args) { int num = 46; // This creates an integer variable called "num" and assigns the value 46 to the variable /* This can also be done in 2 steps. The above line is equivalent to int num; num = 46; */ char grade = 'A'; // character variable with the value A. The literal should be in single quotes. double dbl = 5834.46456; // double variable with the value 5834.46456. Doubles can hold fractional values. double val = dbl / num; // You can assign values that are expressions. In that case, the expression is evaluated and the resulting value is assigned to the variable. boolean coinToss = true; // This is a boolean variable. booleans can only take the values true or false, which are boolean literals. System.out.println("num is " + num + "\ngrade is " + grade + "\ndbl is "+ dbl +"\nval is " + val + "\ncoinToss is " + coinToss); // using the '+' operator here stiches together the strings. } }