Hi new to the forum, so go easy :)
Im very new to Java and im a little stuck...
I have to create a program which uses classes and objects, all of the objects need to be stored in 1 array.
So, i have a super class called Student then 2 subclasses called female and male. So it should look a something like this;
public class Student
student number;
name;
public class Female extends Student(String sGender)
String gender;
gender = sGender;
public class Male extends Student(String sGender)
String gender;
gender = sGender;
Sorry if that looks a little crude. Anyway, my problem is, if i create an array of Student[], then populate it when Females and Males, they lose any unique methods, and every object can only use the methods which are in Student.
I know i can put every method in the super class (student), which are then inherited by the subclasses (Male and Female), but this seems wrong because its taking more code than it should.
Any help would be great.