Search:

Type: Posts; User: javapenguin

Search: Search took 0.08 seconds.

  1. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    Well, you can store all that stuff for1 Student without needing one. However, for a bunch of them...an ArrayList would be preferable as you'd have to create a new Student object by hand for every...
  2. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    Why does it keeping saying "H-Sphere"?

    I keep telling it to say "ArrayList".
  3. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    import java.util.Scanner.*;
    import java.util.ArrayList.*;

    public class Menu
    {

    private ArrayList<Student> studentList; // The ArrayListOfStudents

    // see ArrayList link after coding part...
  4. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    public class Menu
    {

    private ArrayList<Student> studentList;

    private class Student
    {
    // in addition to your constructor for the Student class.

    // You need a Student constructor and a few...
  5. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    I think you only create a new Student object when you add it to the ArrayList.

    The way you're doing it now could work, though it should also be changed to stop it being above like a 4 or 5 for...
  6. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    You have a class called Menu.

    Hmmmmm...unless Student is an inner class, which it could be I suppose, it probably should be in another .java file.

    If you make it an inner class, then you have...
  7. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    A String can only be a String.

    Setting a String value to an int won't work.

    String createStudent = ("x");

    Also, it'd be

    String createStudent = "x";
  8. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    I've seen inner methods a few time, but don't really think this is where you should have your Constructor and stuff inside the main method.


    package ArrayList;

    // to import a package, put...
  9. Replies
    28
    Views
    3,093

    [SOLVED] Re: Help with code

    public Student = ( String fName )

    should be, maybe

    public Student(String fName)
Results 1 to 9 of 9