This Thread Closed !
Printable View
This Thread Closed !
hey if you dont mind can you specify your error or a part where you want help with ? that would be great
mext time do add code tags :)
ok here
Write a PersonAbstract class that has one abstract method: ToString
this states to make the to string method abstract so you dont need to implement the method
; is enoughQuote:
abstract String toString()
But in the other Person class where you extend the abstract class
There you need to implement the toString method. this is called overRiding.
as for the Part B when you extend . you overrite the to String method of the person class.
by declaring the method signature and body where you channge the "tenure" part of the
method as stated in the problem description.
its the same in part c but you need to check for the other "Field"
no
here
and in Teacher & Studend ClassCode:[CODE]abstract class PersonAbstract {
public String toString();
}
I do overriding like this ?
[/CODE]Code:public String toString() {
String message = "Name: " + name + "\n" + "Age: " + age + "\n" + "Tenure: " + tenure + "\n" ;
return message;
}