public class Ex02Variable //class and file have same name { public static void main(String[] args) { int value; //integer variable value = 5; System.out.print("The value is " + value + "\n"); //all variables should be declared up front, this is bad practice, only for showing data types byte inches; //-128 to 127 inches = 127; //128 gives error messsage System.out.print("The byte variable is " + inches + "\n"); int speed = 2147483647; //-2,147,483,648 to +2,147,483,647 System.out.print("The int variable is " + speed + "\n"); //F for float, scientific notation float commission = 0.00000000000034F; //+-3.4x10^-38 to +-3.4x10^38 System.out.print("The float variable is " + commission + "\n"); double distance = 1.7E308; //+-1.7x10^-308 to +-1.7x10^308 System.out.print("The double variable is " + distance + "\n"); //boolean boolean bool; bool = true; System.out.println(bool); bool = false; System.out.println(bool); //char data type char letter; letter = 'A'; System.out.println(letter); letter = 65; //Unicode character set, Java uses Unicode System.out.println(letter); } }