Search:

Type: Posts; User: javapenguin

Search: Search took 0.07 seconds.

  1. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Am updating classes.

    Show me where it's going wrong and how to fix it?

    package DiscreteMathProject;

    import java.util.ArrayList;
    import java.util.Random;

    /**
  2. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Exception in thread "main" java.lang.NullPointerException
    at DiscreteMathProject.Class.getStudentsInClass(Class.java:122)
    at DiscreteMathProject.Class.toString(Class.java:113)
    at...
  3. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    public String getStudentsInClass()
    {

    for (int i = 0; i < aList.size(); i++)
    {
    aList2.add(aList.get(i).getName());
    }
  4. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    If I change it to that in getStudentsInClass I get a Null Pointer Exception
  5. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Where do I change this?

    In my MainClass or in Class?

    If the Class class, inside what method?
  6. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Ok, what is that doing?
  7. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    How would I use the for each loop?

    I'm not very familiar with those.

    Where would it go?
  8. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    The size of class Sleeping 101 is 15
    The size of class Partying 202 is 24
    The size of class Discrete Math is 24
    The size of class Rocket Science is 15
    The size of class Introduction to Data...
  9. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 15
    at DiscreteMathProject.MainClass.<init>(MainClass.java:213)
    at DiscreteMathProject.MainClass.main(MainClass.java:836)...
  10. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    I think that the number of students in the brackets, the number of students the class says there are in the class that the toString() generates, and the class size are all not matching.
  11. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    Ok, these are my class sizes, in order.

    The ones that did print out right are also in order in the classes array.

    20
    18
    15
    17
    15
    16
  12. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    The class: Sleeping 101 is at 8:00 a.m.and has 15 students. The students in it are: [Adolf Hitler, Paul Adcock, Albert Einstein, Martin Luther, Darth Vader, John Wayne, Julius Ceasar, Spongebob...
  13. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    What's wrong with this:


    public String getStudentsInClass()
    {

    for (int i = 0; i < getSize(); i++)
    {
    aList2.add(aList.get(i).getName()); // it points to...
  14. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    No, it's not that it'll accept class sizes of only 15. This is proof.

    The class: Sleeping 101 is at 2:00 p.m.and has 15 students. The students in it are: [Susan B. Anthony, Martin Luther, Peter...
  15. Replies
    20
    Views
    2,002

    Re: ArrayList troubles

    The class: Partying 202 is at 12:30 p.m.and has 15 students. The students in it are: [Darth Vader, Sherlock Holmes, Joe McDonald, Martin Luther, Abraham Lincoln, Albert Einstein, Julius Ceasar,...
  16. Replies
    20
    Views
    2,002

    ArrayList troubles

    Hey, I'm starting a new thread since my thread "Using Random class" may or may not have the error due to the class Random. More likely it's something wrong with one of my ArrayLists.


    package...
Results 1 to 16 of 16