public class Main04 { public static void main(String[] args) { int people = 12; people = 5; // changes value, replacing the 12 int cookies = 3; cookies = people * 2; // people is now 5, so 5*2, so 10 String greeting = "Hi"; // final is how Java makes constants final String CLASS = "CIS 115"; greeting = "Welcome to " + CLASS; // "Welcome to CIS 115" String str = "hello"; // implicit cast double d = 3; // 3.0 double d2 = 3.9999999; // still 3.9999999 in Java; casting is not rounding // explicit cast int i = (int) 3.9; // 3 System.out.println("people: " + people); System.out.println("cookies: " + cookies); System.out.println("greeting: " + greeting); System.out.println("d: " + d); System.out.println("d2: " + d2); System.out.println("i: " + i); //----------------------------------------- int x = 3; int y = 4; y = y + 1; int z = 2 + x * y + 1; String first = "Constance"; String last = "de Coverlet"; String name = first + " " + last; String str1 = "x" + x + "y" + y; // Print all variables System.out.println("x = " + x); // 3 System.out.println("y = " + y); // 5 System.out.println("z = " + z); // 18 (2 + 3*5 + 1) System.out.println("first = " + first); // Constance System.out.println("last = " + last); // de Coverlet System.out.println("name = " + name); // Constance de Coverlet System.out.println("str1 = " + str1); // x3y5 } }