Results 1 to 2 of 2

Thread: beginners java questions[3chapters first]

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default beginners java questions[3chapters first]

    Code:
    public class xxxXXX
    { 
     public static void main() 
     {
       
     }
    }
    1. "static" what means ?
    2. the class xxxXXX how is executed in this java program(file) , I mean the whole java program contained ? A class that has method "main" differs from a normal class ?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    'static' means that the method belongs to the class itself, not to the instances of the class (i.e. you do xxxXXX.main(foo) rather than (new xxxXXX()).main(foo)).

    You run the application like you would any other: java <classname>. A class with a public static void main(String[]) differs from other classes only in that it can be used as an entry-point into your application.

    It's conventional to begin class names with a capital letter.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •