public class Examples { public static void main(String [] args) { int number = 2147483647; // 2^31 -1 System.out.println(number); number = number + 1; // -2^31 System.out.println(number); int a = 4; int b = 5; System.out.println("a :: " + a); System.out.println("b :: " + b); //++a is the same as saying a = a + 1; System.out.println("a++ :: " + a++); ///these two calls have different results System.out.println("++b :: " + ++b); a += 3; b *= 2; System.out.println("a += 3 :: " + a); //Short cuts, this is the same as saying a = a + 3 System.out.println("b *= 2 :: " + b); //b = b * 2 a /=4; b -= 6; System.out.println("a /=4 ::" + a); a = a / 4; System.out.println("b -= 6 :: " + b); b = b - 6; a = 114; char c = 's'; System.out.println("(char)a :: " + (char)a); //casting a int to a char and a char to an int - use the ASCII table to see how it works System.out.println("(int)c :: " + (int)c); a = -16; System.out.println("Math.abs(a) :: " + Math.abs(a)); ///Math class has several static methods that are useful System.out.println("Math.abs(a) :: " + Math.sqrt(Math.abs(a))); String name = "Devin"; //The String class in the API has many, many methods to manipulate and work on Strings. System.out.println("name :: " + name); System.out.println("name.length :: " + name.length()); System.out.println("name.toLowerCase() :: " + name.toLowerCase()); //Casting exercises int regular_int = 32768; // 4 bytes short short_int = 32767; //2 bytes 2^16 -1 short_int = (short)regular_int; //If you do not cast, then you get an error } }