1  // Application to sum numbers
  2  
  3  public class Sum
  4  {
  5     public static void main (String[] args)
  6     {
  7        // variable declarations of primitive types, initialization
  8        int a=2, b=3, firstsum;
  9        double x = 4.5, y, secondsum;
 10        float f = 1.2F;
 11  
 12        // arithmetic and assignment
 13        firstsum = a + b;
 14  
 15        // cast - type conversion - not required here
 16        y = (double) firstsum;
 17  
 18        /* more arithmetic and print to standard out 
 19              using string catenation to prepare output string */
 20        secondsum = x + y;
 21        System.out.println("\n" + "The first sum is " + firstsum);
 22        System.out.println("The second sum is " + secondsum + "\n");
 23     }
 24  }
 25