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 class forname used for?
What is the difference between state-based unit testing and interaction-based unit testing?
Highest level event class of the event-delegation model?
Explain wait() method of object class ?
How many types of the indexof method are there for strings?
What is string intern in java?
How does a for loop work?
What are computer functions?
What is the relationship between class and object?
What modifiers may be used with an inner class that is a member of an outer class in java programming?
Explain the difference between call by refrence and call by value?
Why are constructors used?
How many bits is a string in java?
What do you mean by JVM?
What is use of super keyword in java?