In Java why we write public static void main(String args[])
why not main()?
Answer Posted / preetham m.s.
he main method is the first method, which the Java Virtual
Machine executes. When you execute a class with the Java
interpreter, the runtime system starts by calling the
class's main() method. The main() method then calls all the
other methods required to run your application. It can be
said that the main method is the entry point in the Java
program and java program can't run without this method.
The signature of main() method looks like this:
public static void main(String args[])
The method signature for the main() method contains three
modifiers:
public indicates that the main() method can be called by
any object.
static indicates that the main() method is a class method.
void indicates that the main() method has no return value.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of main function in java?
What is the difference between jdk and jre?
What is the difference between normal report & matrix report?
Is java free for commercial?
State one difference between a template class and class template.
Is c better than java?
what is synchronization? : Java thread
Why are the objects immutable in java?
What does n mean in java?
What is the final access modifier in java?
How to retrieve data from database in java using arraylist?
Is arraylist an object in java?
What is a hashmap used for?
Can we change the scope of the overridden method in the subclass?
what is meant wrapper classes?