Why do we need main method to execute a java program?
Main method is auto called by JVM. It is the place, where JVM enters into the class. It is called before the class is instantiated by its constructor. There are below reasons on its signature.
1. Public access modifier: it is visible to outer environment called JVM.
2. Static non-access modifier: it is called before the class is instantiated, hence JVM use class name to call the main method.
3. Void return type: It return no value to JVM.
4. String array parameter: It takes command line arguments.
| Is This Answer Correct ? | 11 Yes | 1 No |
What is an exception?
What is charat ()?
What is pre increment and post increment in java?
class A { public void disp(int a,int b) { System.out.println("hai"); } } class B { public void disp(int a,int b,int c) { System.out.println("hai"); } } above program is overloading or overriding?
What is a function argument in java?
What is an object?s lock? Give name of object?s that have locks?
What class allows you to read objects directly from a stream in java programming?
What is persistence ?
When parseint method can be used?
Where is java located?
What is singleton class in ruby?
What is the use of hashmap in java?