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...
Type: Posts; User: javapenguin
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...
Why does it keeping saying "H-Sphere"?
I keep telling it to say "ArrayList".
import java.util.Scanner.*;
import java.util.ArrayList.*;
public class Menu
{
private ArrayList<Student> studentList; // The ArrayListOfStudents
// see ArrayList link after coding part...
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...
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...
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...
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";
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...
public Student = ( String fName )
should be, maybe
public Student(String fName)