Hello, I'm learning about super class.
I am having some problems.
Basically I am asked to determine whether an object of a super class array is of type of subclass.
However i can't use instanceof or getClass.
So i was thinking of using booleans.
So i made a boolean in the subclass that i want and set that to true.
Now i'm trying to pass this new boolean to the superclass however i get this error message: cannot reference grad before supertype constructor has been called
I changed the super class parameters to include the new boolean. However i still get this message.
You're probably going to have to show us the code.
However, the obvious question is why can't you use instanceof? Because that's what it's for.
Joined: May 15, 2012
I know instanceOf is what it's for but i was told not to use it.
Here is my code:
basically when i use the printGradStudent() method it should print out only the grad students. However to do this it must be able to differentiate which is a grad student and which is a undergrad student.
The method is not completed yet b/c i had to change it or it wouldn't compile.
I was thiniking of justing making a boolean variable in printGradStudent() and send that to super class (Student) in order to determine if the object is of type GraduateStudent