main() method is starting execution block of a java program.
If any java class contain main() method known as main class.
http://www.tutorial4us.com/java/java-main-method
2. Main method in java
Main() method is starting execution block of any java
program. If any java class contain main() method
known as main class.
Syntax
public static void main(String args[])
{
.......
.......
}
3.
4. Keywords used with main method
• Public: main method is preceded by public
keyword it means main method scoop is
available anywhere in java program.
• Static: memory allocated for main method
only once.
• Void: nothing return
• String args[]: String array used to hold
command line arguments in the form of String
values.
5. Example of main method
public class mainclass
{
public static void main(String[] args)
{
System.out.println("I am from Main()");
}
}