// DrJava saved history v2 8 + 3 7 + 2 3.0 + 5.6 9 / 2 // Java has different types. // A type is a set of values and a set of operations on // those values. // This is a Java comment, because the line starts with // // Java ignores everything after // Java has different types. // 9 and 2 are type int, so the expression "9 / 2" gives // us an int result. 9.0 / 2.0 // 9.0 and 2.0 are of type double, so the expression // evaluates to give a double value (4.5) 9 / 2.0 // operations on ints and doubles: + - / * Integer.MAX_VALUE Integer.MIN_VALUE Double.MIN_VALUE Double.MAX_VALUE 1.0 / 3 // In Java, real numbers are called floating-point numbers. // Floating-point numbers are approximations to real numbers. 1.0f / 3 // Two floating-point types: float and double // We'll usually use type double. // Double has twice as many significant digits as float. Float.MAX_VALUE Float.MIN_VALUE