Results 1 to 11 of 11
  1. #1
    flagrl is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default takinga java class in college but need help

    we are using netbeans and we have to make 4 different classes inside a package.my question is after you assign a main method to the first class what do you do with the rest of the classes? i write the program but it gives me an error. it doesnt say what error and it runs the first class. i have no clue how to start the other classes. my teacher just skimmed right over that. i dont have my book yet. it should be here this week. which will be so helpful. i have one book i picked up from the libarary and will pick up a different one tommorow but it covers java 1.4 is that too old and outdated to learn anything from till my school book gets in? thank you guys in advanced. i hope i made sense with the question

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,558
    Rep Power
    23

    Default Re: takinga java class in college but need help

    If you are having trouble with your IDE, there is a section of this forum dedicated to the IDEs.

    If you are having problems with your java code, post the full text of the error messages here and the code where the error occurs and add your questions about the problem.

  3. #3
    flagrl is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: takinga java class in college but need help

    my question is if you have more than one class in a package. and you already assigned a main method do you have to assign a second method to the second class and 3rd to the 3rd class and so on and so forth. and if so how do you do that?

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,558
    Rep Power
    23

    Default Re: takinga java class in college but need help

    Every class can have a main method. There are no java restrictions on which classes can have a main method.
    The main method is needed for the java command to be able to start the execution of a specific class. If all the classes have the main method then you can start each/any of them with the java command. For example I add a main method to many of my classes and include standalone test code in them so I can test the class without any other classes needed.

    You can have many different methods in every class as long as their definitions do not confuse the compiler.

  5. #5
    flagrl is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: takinga java class in college but need help

    oh ok my teacher said only one main method. i thought she meant for the whole package. thank you i will try assigning a main method to it see if that works :)

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,558
    Rep Power
    23

    Default Re: takinga java class in college but need help

    What do you mean "see if that works"?

  7. #7
    flagrl is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: takinga java class in college but need help

    to see if i got my program right and it will run

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,558
    Rep Power
    23

    Default Re: takinga java class in college but need help

    You never posted the error messages.
    Can you describe what was happening and what you did to cause that to happen.

  9. #9
    flagrl is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: takinga java class in college but need help

    its not giving me an error message it wont let me compile it and when i try to run the program it says that there are errors and if i press i want to continue it will just run the first class in the package.
    this is what i have in netbeans

    package lab1;

    /**
    *
    * @author cerissa
    */
    public class PersonalInformation
    {
    public static void main method(String[] args)
    {
    System.out.println("test");
    }


    }

  10. #10
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,558
    Rep Power
    23

    Default Re: takinga java class in college but need help

    Sorry, I have no idea how your IDE works or how to use it.
    I use the javac and java commands to compile and execute my programs.

    There is a section of the forum for help with IDEs. Go ask there how to use your IDE.

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

    Default Re: takinga java class in college but need help

    This discussion is continued at what is wrong with this? cant figure it out

    Closing this thread.

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

Similar Threads

  1. college program
    By cagipple in forum New To Java
    Replies: 3
    Last Post: 03-06-2011, 11:39 PM
  2. College "java" paper.....a couple opinions?
    By hayden06f4i in forum New To Java
    Replies: 6
    Last Post: 11-01-2010, 07:15 AM
  3. Independent Study at College
    By Sno in forum Forum Lobby
    Replies: 2
    Last Post: 10-13-2010, 05:21 PM
  4. Is JSP good for college management system
    By Motish in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 07-22-2010, 12:05 PM
  5. java college project
    By guneet singh in forum Networking
    Replies: 8
    Last Post: 01-20-2009, 04:38 AM

Posting Permissions

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