basic java code 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 code

java basic code example

Example 4: HOW TO CODE JAVA???????????

int[] marks = {50, 55, 60, 70, 80}; System.out.println(marks[0]);// Output: 50 System.out.println(marks[4]);// Output: 80