what is use of public static void main

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manu verma
    New Member
    • Sep 2010
    • 2

    #1

    what is use of public static void main

    what is use of public static void main.
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    It is a function. This function also provides a specific entry point into a class.

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      It is the defaiult main entry point to the application, assuming that your class is the entry class.

      Outside that, it is naught more than any other public static method, and can be used thus, if your program needs to.

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        It acts as an entry point to your class.

        Regards
        Dheeraj Joshi

        Comment

        • Laxmikant Masuti
          New Member
          • Sep 2010
          • 2

          #5
          use of public static void main

          we use public static void main because porgram execution starts with the main method so main method is must necessary in program

          we use public because it is accesible to all the classes.

          static reserves the memeory into the RAM

          void ,it can't return any value.

          Comment

          • satz
            New Member
            • Sep 2010
            • 1

            #6
            in java every thing should declared in class, so the main should written in class but executing the main is to run the program so we declare the main public static void main
            in command we run the program like
            >java bytecodeclass
            writing the above command the JVM calls the main method inside the bytecodeclass
            executing the main out side the program i.e, so we declare public
            static :
            static is a keyword and use of static is with out creating the object we call the methods or variables so thats why
            we declare static
            running program we call the bytecodeclass i.e, in which
            class we write the main that bytecodeclass we called and the main method doesn't return values so we write void

            Comment

            Working...