Results 1 to 3 of 3

Thread: Main method

  1. #1
    suresh.sa is offline Member
    Join Date
    Oct 2010
    Posts
    14
    Rep Power
    0

    Default Main method

    hi Friends,

    Good morning to all...


    Can we have more than one main method in the java program, and

    can we able to over-ride or over-load a main method in java.





    Thanks & Regards,
    S.A.Suresh.

  2. #2
    joshdgreen's Avatar
    joshdgreen is offline Senior Member
    Join Date
    Oct 2010
    Location
    Colorado Springs, CO
    Posts
    212
    Rep Power
    5

    Default

    There can only be one main method per program. This is how the program knows where to start execution. Everything else can and should be done through other methods.
    Sincerely, Joshua Green
    Please REP if I help :)

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    There can only be one "static main(args)" method per class.

    You can have several in your program (though I suppose the term "program" might be a bit misleading, "project" might be better), but only one can be used on a particular run as the entry point.

Similar Threads

  1. Calling The main method from another method
    By SwissR in forum New To Java
    Replies: 3
    Last Post: 07-27-2010, 12:03 PM
  2. Main Method Help
    By thomas6 in forum New To Java
    Replies: 0
    Last Post: 03-12-2010, 02:20 AM
  3. Help with main method
    By eliCanzee in forum JDBC
    Replies: 4
    Last Post: 01-06-2010, 10:12 AM
  4. calling method from main method
    By bob_bee in forum New To Java
    Replies: 4
    Last Post: 10-02-2009, 06:30 PM
  5. Where do I put main method?
    By jerryrice80 in forum New To Java
    Replies: 4
    Last Post: 09-16-2009, 09:23 PM

Posting Permissions

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