Results 1 to 5 of 5
  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Main Methods in Package

    Friends ... Can a java package have more than one main methods ??? Its not working for me ..

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: Main Methods in Package

    Classes have methods, packages don't, so your question is moot.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,784
    Rep Power
    7

    Default Re: Main Methods in Package

    Each class can have its own main method but only one will be the entry point of the program. This is generally done for unit testing purposes. If all these classes belong to the same package then technically it is possible to have more than one main method but again only one would be the entry point of the program. I hope you don't plan on having the main method in one class calling a main method in another class. Remember that Java is an OO language.

  4. #4
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Main Methods in Package

    sorry i was asking about classes .. Junky understands what i want to say ...ok ..what is this OO ???

  5. #5
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,510
    Rep Power
    5

    Default Re: Main Methods in Package

    Object Oriented

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. Can you have methods within the main method?
    By gellegbs in forum New To Java
    Replies: 4
    Last Post: 05-01-2013, 05:04 AM
  2. No main methods ?
    By Niehm in forum New To Java
    Replies: 2
    Last Post: 04-22-2012, 03:16 AM
  3. how can main call other methods?
    By rahuld.exe in forum New To Java
    Replies: 1
    Last Post: 04-06-2012, 01:19 PM
  4. Classes and main methods?
    By CyberFrog in forum New To Java
    Replies: 17
    Last Post: 05-26-2009, 04:47 AM
  5. Running main in a package...
    By Bizmark in forum New To Java
    Replies: 1
    Last Post: 04-07-2008, 01:58 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
  •