Untitled Document

Subscribe here to get updates on new Videos

 

12. Explain about public static void main(String[] args); (PART- II) ?

 

 

 

previous homenext

 

Case 1:

Overloading of the main method is possible but JVM will always call String[] argument main method only.

The other overloaded method we have to call explicitly then it will be executed just like a normal method call.

Program:

Case 2:

1. Inheritance concept applicable for the main method. Hence while executing child class if child class doesn’t contain main method then parent class main method will be executed.

Program:

Case 3:

It seems overriding concept applicable for main method but it is not overriding it is method hiding.

Program:

Note:

For main method inheritance and overloading concepts are applicable but overriding concept is not applicable instead of overriding method hiding concept is applicable.