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 |
Implementations of set interface?
What is meant by singleton class?
What are the main differences between the java platform and other platforms?
When do you call copy constructor?
0 Answers Tavant Technologies, Virtusa,
when you will synchronize a piece of your code? : Java thread
Do I need java for windows 10?
Explain the role played by Java Virtual Machine in Java Programming?
What are command line arguments?
How we create object in copy constructor?
Can you override private or static method in java?
Explain about instanceof operator in java?
What is the difference between overloading and overriding a function?
13 Answers eG Innovations, Infosys, TCS,