Originally posted by Vanitha Sugumaran:
Hi,
In my book, the answer choices are like this..
Which is legal definition of a class that can't be instantiated?
a)class Ghost{
abstract void haunt();
}
// compiler error since class isn't declared abstract
b) abstract class Ghost{
void haunt();
}
// the method haunt is not implemented (no braces)
c) abstract class Ghost {
void haunt(){};
}
// this is legal definition of the abstract class
so the answer choice c is correct
d)abstract Ghost{
abstarct void haunt();
}
// missing class
hope this helps,
Vanitha.
I do totally agree with you but the C coming from Tosin is not exactly the same,
abstract class Ghost{
absract void haunt (){};
}
The method is also declared abstract with braces! And he says that's the good answer. I feel that there is no good answers in his case. Maybe he didn't pay attention when copying? Do you have the same book?