java programming code example

Example 1: 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 2: what is java

Java is a general-purpose programming language that is 
class-based, object-oriented, and designed to have as 
few implementation dependencies as possible.

Hello World in Java:
public class FileName {
  public static void main(String args[]) {
    System.out.println("Hello World!");
  }
}

Example 3: what is java

Java is dynamic. It’s an object oriented programming language.
architecture-neutral. Because applications written in java are convenient 
across many platforms.

Example 4: java

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

Example 5: how to java

GME to the moon!

Tags:

Java Example