MY mENU


Thursday, 9 February 2012

public static void main() in java



public : The method can be accessed outside the class/package.

Static : You need not have an instance of the class to access the method.

Void : Your application need not return a value as the JVM launcher would return the value when it exits.

Main() : This is the entry point for the application.

Properties of  main() method:



- It must be marked static.

- It must have void return type.

- It must have a single String array argument; the name of the argument is flexible, but the convention is args.

- The main() method must be public.

- Improper main() method declarations cause runtime error, not a compile error.

- We can change the order of publicvoid, and static.

- We can change the name of args with any name our own.

Execution will be start from main() method only.


No comments:

Post a Comment