posted 20 years ago
This is from Certification book by Kathy Sierra and Bert Bates. (chapter 2, Q3)
abstract class A{
abstract short m1();
short m2(){return (short) 420;}
}
abstract class B extends A{
short m1(){return (short) 42}
}
wouldn't this statement be true in this case?
"if class A was not abstract and method m1() in class A was implemented, the code would not compile"
how can an abstract class extend a non abstract class? is it legal? the other question is since in this statement he didn't say anything about removing the abstract keyword, just saying implements is vague. so it should give a compiler error, if its abstract and implemented.