Java Classes:
For example, if x is an int with the value 5, then System.out.println("x = " + x) displays x = 5 on the screen.
For example, if s is "hot chocolate", then s.length() evaluates to 13.
For example, if s is "iced tea", then s.substring(3, 7) evaluates to "d te".
For example, if s is "orange", then s.equals("orange juice") evaluates to false, but (s + " juice").equals("orange juice") evaluates to true.
Notice that (s + " juice" == "orange juice") evaluates to false.
For example, if s is "Ice Cream Float!", then s.toLowerCase() evaluates to "ice cream float!".
For example, if s is "MILK shake", then s.toUpperCase() evaluates to "MILK SHAKE".
For example, if s is "hot chocolate", then s.charAt(0) evaluates to 'h' and s.charAt(4) evaluates to 'c'. To find the last character in a string s, use s.charAt(s.length() - 1).
ccj Classes:
For example, Numeric.randomInt(-3, 7) evaluates to one of the following integers: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, or 7.
For example, Numeric.randomDouble(2.5, 1.2) could evaluate to any of the following (among many others): 2.25, 1.2, 1.23, 2, etc.
For example, the following code fragment prints the number of seconds left today.
Time now = new Time(),
midnight = new Time(now.getYear(),
now.getMonth(),
now.getDay()+1);
System.out.println("There are " + midnight.secondsFrom(now) +
" seconds left today.");
For example, new Point(1, 2).move(3, 9).getX() evaluates to 4.
For example, new Line(new Point(), 45, 5) creates a line of length 5 directed from the origin at a 45 degree angle.