ArrayList of Objects compile error
807606Feb 20 2007 — edited Feb 20 2007hi all,
i am getting a weird error "constructor Person() not found" in the Student class.... help neone ??
public class Person {
String fName;
String lName;
public Person (String firstName, String lastName) {
fName = firstName;
lName = lastName;
}
/** Retruns the person's name in the format: lastName, firstName.
* (i.e. the last and first names with a comma between them.)
*/
public String toString() {
return (this.lName+","+this.fName);
}
}
import java.util.ArrayList;
public class Student extends Person {
private static ArrayList<Student> students = new ArrayList<Student>();
private ArrayList<Mark> marks = new ArrayList<Mark>();
/** Constructor for Student adds the new Student to the list of
* all students.
*/
public Student(String firstName, String lastName) { //<-- gives me error here
students.add(new Person(firstName, lastName));
}