You must Sign In to post a response.
  • Category: Hosting Services

    What is the meaning?

    ][..Well when we are programming JAVA, we use to start with the keywords Public Static Void Main(..) {..}.

    I just want to know the meanings of these four keywords in detail? And why we are using it?
  • #5384
    Hi Jeevan,

    PUBLIC: Public is a keyword which is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceed by public, then that member may be accessed by code outside the class in which it is declared. In this case, main() must be declared as public, since it must be called by code outside of its class when the program is started.

    STATIC: Static is a keyword which allows main() to be called without having to instantiate a particular instance of the class. It is necessary since main() is called by the java interpreter before any objects are made.

    VOID: Void is a keyword whic simply tell the compiler that main() does not return a value. May methods also return values.

    MAIN(): Main() is the method called when a java application begins. Java is a case-sensitive. Thus, Main is different from main. IT is important to understand that the java compiler will compile classes that do not contail a main() method. But the java interpreter has no way to run these classes.


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.