Saturday, December 1, 2012

main() method in java

The main function is important function in Java programming language. 
The main method is the first method, which the Java Virtual Machine executes. When you execute a class with the Java interpreter, the run time 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.

Public static void main (String args[])
Public is an Access Specifier.

static is a keyword which illustrates that method shared along all the classes.
void illustrates that this method will not have any return type.
main is the method which string has an argument. 
Public specifier makes the method visible outside the Class and because of the static nature of the method, JVM can call this main method without instantiating the class.

No comments:

Post a Comment