Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: information on main method

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default information on main method

    Hello,
    Following is my case.

    i have main method in which i have a switch case.
    i'm instantiating my objetcs in the main ;

    public class BoiteALettres
    {
    public static void main(String[] args) throws IOException
    {
    ObjetPostal BoiteALettresListe[]= new ObjetPostal[2];
    Colis c1=new Colis();
    Lettre let1= new Lettre();
    BoiteALettresListe[0]=c1;
    BoiteALettresListe[1]=let1;
    /* some instructions*/
    switch (choix)
    {
    case "lettre":
    infoSurLettre();
    break;
    case "colis":
    infoSurColis();
    break;
    default:
    System.out.println("Mauvaise choix ; Lettre ou Colis : ");
    }

    public static void infoSurLettre()
    {
    System.out.println("inside lettre "+ BoiteALettresListe[0].isLettrePrioritaire());

    }

    How to make visible the objets and its methods to my calling function infoSurLettre()
    i have tried also to instantiate before the main methid and it does not work.
    Any help


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: information on main method

    Please read this topic to learn how to post your code correctly along with other interesting info. Fix your post when you've figured it out.

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: information on main method

    Starts with p and ends with meter.
    Improving the world one idiot at a time!

Similar Threads

  1. keyboard scanner to take users input and enter students information method
    By foresboo in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 7th, 2013, 04:39 PM
  2. Replies: 3
    Last Post: October 31st, 2011, 12:42 AM
  3. How do I call a method from the main method?
    By JavaStudent1988 in forum Java Theory & Questions
    Replies: 5
    Last Post: October 19th, 2011, 08:37 PM
  4. [SOLVED] method inside main()
    By rohan22 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 14th, 2011, 11:42 PM
  5. Having trouble printing object information in main class
    By KingLane in forum Object Oriented Programming
    Replies: 1
    Last Post: October 11th, 2009, 06:53 PM