simple java program code example

Example 1: java code to print hello world

class Simple{  
    public static void main(String args[]){  
     System.out.println("Hello Java");  
    }  
}

Example 2: basic java coding

public class AddTwoNumbers {

   public static void main(String[] args) {
        
      int num1 = 5, num2 = 15, sum;
      sum = num1 + num2;

      System.out.println("Sum of these numbers: "+sum);
   }
}

Example 3: java example

class Anupam
{
  public static void main(String...args)
  {
    System.out.println("HI this is Anupam Guin ");
  }
}

Tags:

Java Example