Your setters should take a parameter, so it knows what value to set
for example, in Student:
public void setFirstName(String fName) {
firstName = fName;
}
sets the field firstname
in the Student
class, from the value of the fName
method parameter.
When you call the method from main
, include the forename from the file you are reading:
myStudent.setFirstName(scanner.next());
You don't need a scanner in your Student class.
Change all your setters to take a parameter, and use the Scanner
in main
to supply the values.