Method in java, Simple main method Example 2

Java Programming Language / Class, Object and Methods in java

1004

Program:

 public class MainMethod {

   public static void main(String[] args) {
	  System.out.println("I am in Main Method");
      int a = 30;
      int b = 42;
      int c;
      c=a+b;
      System.out.println("Answer= " + c);
   }
}

Output:

I am in Main Method
Answer= 72
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.