posted 18 years ago
This should make it clearer
abstract class Abstract{
// A class with an abstract method
abstract void doThis();
}
abstract class A extends Abstract{
// extends abstract but provides no implementation, and hence decld. abstract
}
class B extends Abstract{
// B extends Abstract, but provides no implementation AND is NOT abstract
// The compiler throws an error
}
Therefore, a subclass of a class with an abstract method must either be declared abstract or must provide an implementation of the abstract method.
I put that phrase in bold because, it is only true for classes that have abstract methods, and not necessarily abstract classes in general.
abstract class A{
void someMethod(){}
}
class B extends A{
// not abstract, doesn't override the someMethod of A
// no problem
}
"It's not enough that we do our best; sometimes we have to do<br />what's required."<br /> <br />-- Sir Winston Churchill