next up previous
Next: 1.3.6 Capitalization Conventions Up: 1.3 Java Notation and Previous: 1.3.4 A Sample Java

1.3.5 Variations on the Sample Program

Any valid Java expression can be substituted for the string ``Hello, world'' in the class Hello above. The resulting program will print the value of the specified expression. For example, the program

class Hello {
  public static void main(String[] args) {
    System.out.println((98.-32.)*(5./9.));
  }
}
prints the value
36.66666666666667
which is the Centigrade equivalent of 98 degrees Farenheit.



Robert Cartwright, Spring 1999