Results 1 to 5 of 5
  1. #1
    ladykrimson is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default Method Will Not Output

    I am currently enrolled in a Java programming class. I have an assignment to create five classes, four for an Instructor, Student, Course, and Section; and one that will have the main method. Each of the classes has attributes and methods.

    I had no problem doing this part of the assignment. Now, I need to instantiate the Instructor, Course, and Student classes and have the system display them. I managed to do this for the Instructor and Course classes, but the Student class is a little more complicated. For the Instructor and Course classes, I only need to create one instance of each, but for the Student class, I must create 15 instances. Considering that I have not yet learned how to make an array, I elected to use a text file. Here is the code that I wrote for it:

    Java Code:
                // Create the list of student names
                PrintWriter outputFile = new PrintWriter("StudenList.txt");
                outputFile.println("Donna Richards");                                    
                outputFile.println("Cindy Maxwell");
                outputFile.println("Eddie Grant");
                outputFile.println("Stuart Blake");
                outputFile.println("Jane Parker");
                outputFile.println("Wesley Forrester");
                outputFile.println("Susan Jackson");
                outputFile.println("Morris Chambers");
                outputFile.println("Elsa Cleetz");
                outputFile.println("Tony Redmenson");
                outputFile.println("Claira Shultz");
                outputFile.println("Billy Westington");
                outputFile.println("Iris Peters");
                outputFile.println("Adam Avery");
                outputFile.println("Patricia Long");
                // Open the file and assign text file to variable, MyFile
                File myFile = new File("StudentList.txt");
                //Assign MyFile to Scanner inputFile
                Scanner inputFile = new Scanner(myFile);
                Scanner input = new Scanner(;
                while (inputFile.hasNext()){
                    // Instantiation of Student class
                    Student stdt = new Student(); 
                    //Set variable FullName to the next name listed in the file
                    // Print the current value of the variable
    Using Netbeans, I receive no compiler errors with this code, but it does not display the list. Am I missing something?
    Last edited by DarrylBurke; 09-26-2012 at 05:52 AM. Reason: Changed title

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Method Will Not Output

    Quote Originally Posted by ladykrimson View Post
    Am I missing something?
    Possibly the letter 't'?

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

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power

    Default Re: Method Will Not Output

    If you are working with NetBeans why don't you debug the code and try to find the error. It's easy and I believe you could do that.

  4. #4
    ladykrimson is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default Re: Method Will Not Output

    *smacks own forehead* I see it (Studen_List.txt. Thank you very much!

  5. #5
    ladykrimson is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default Re: Method Will Not Output

    I am not quite familiar with the debugger yet. I am still learning how to use it productively. I see the mistake, now. Thank you.

Similar Threads

  1. Battleship Program Coding Assistance
    By nekaneka19 in forum New To Java
    Replies: 7
    Last Post: 03-21-2012, 07:26 PM
  2. Assistance with Basic authentication program
    By Fargo94 in forum New To Java
    Replies: 4
    Last Post: 05-17-2011, 10:22 AM
  3. Ladder Program (Need Assistance)
    By Grenade in forum Jobs Discussion
    Replies: 1
    Last Post: 12-14-2010, 11:21 PM
  4. Assistance needed ASAP: Postpix program
    By Debonairj in forum New To Java
    Replies: 18
    Last Post: 07-27-2010, 02:37 PM
  5. Replies: 7
    Last Post: 11-23-2009, 09:42 AM

Tags for this Thread

Posting Permissions

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