Java main method

writing4angels By writing4angels, 26th Nov 2010 | Follow this author | RSS Feed | Short URL
Posted in Wikinut>Guides>Technology>Computer Software

For the basic programmers in java as well as for the interviews having the knowledge about the structure of main method is a must.

Java main method

Let us have a look at simple java program that will give an output of a sentence:

First java program.

Class FirstProgram


public static void main(String args)


System.out.println(”First java program”);



As shown in the above example the name of the java class is FirstProgram and there is java main method that has the print statement to give the output on command line.

Java main method as shown here is:

Public: Can be accessed outside the class and package.

Static: Can be accessed by the interpreter without creating object and there is only one reference to point to main method.

Void: Returns no datatype.

Argument: Java main method accepts arguments from command line called command line arguments in the form of array.

Java main method is the starting point of your application and triggers the execution of your program.


Java Applet, Java Enhanced Loop, Java Main Method, Java Programming, Java Script, Java-Deprived, Javascript, Javon Nelson, Main Method, Main Method In Java

Meet the author

author avatar writing4angels
A real lover of literature and I appreciate good works of other fellow writers who have given priceless contribution to the content on Internet.

Share this page

moderator Mark Gordon Brown moderated this page.
If you have any complaints about this content, please let us know


Add a comment
Can't login?