Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

public static void main(String[] args)


public Static Void main(String[]  args)

In Java, the execution of an application starts this method, with signature 'public Static void main(String[]  args)'


What does it mean ?

public  - Accessible from the out side of the class, It is required to get access to this method.

static - Class level access as no object is being created yet.
void - returns nothing while exiting from the application to the system which make sure the scope is destroyed on exit.

main - Fixed name defined to identify the entry point for JVM 

string[] args - String array as argument to the application

Why string[] args ?


arguments can be passed to the application via string[] args  on execution through the terminal in case if some data is needed for the application and it is optional.

public class App
{
    public static void main( String[] args )
    {
System.out.println(Arrays.asList(args));
    }
}


Reference

1. https://docs.oracle.com/javase/tutorial/getStarted/application/index.html





This post first appeared on Devdummy, please read the originial post: here

Share the post

public static void main(String[] args)

×

Subscribe to Devdummy

Get updates delivered right to your inbox!

Thank you for your subscription

×