I'm having trouble accessing an object. Here's some of my code...
The accessor method in my Student class works fine when used on an object that has a name. For example...Code:public class Student{
public Student(int h, int a, int i, String n) {
height=h;
age=a;
iq=i;
name=n;
}
public String getName() {
return name;
}
}
However when I create an object that doesn't have a name, how am I supposed to use the accessor method on it?Code:Student studentA = new Student(172,22,110,"gary");
System.out.println(studentA.getName());
The reason I'm creating objects without name is because I've written a program that creates student objects based on input from a scanner class. I don't know if it's possible to name objects using input from a scanner.Code:new Student(182,18,122,"gary");
System.out.println(???.getName());

