the question is from the book <Complete Java 2 Certification Study Guide>. question: Whick one of the following statement is true? A. An abstract class may not have any final methods. B. A final class may not have any abstract methods. answer: B. Any class with abstract methods must itself be abstract,and a class may not be both abstract and final.Statement A says that an abstract class may not have final methods,but there is nothing wrong with this.The abstract class will eventually be subclassed,and the subclass must avoid overriding the parent's final methods.Any other methods can be freely overridden. But I think the answer A is correct,too. Anybody can help me,please?
An abstract class does not dictate that all its methods be abstract. An abstract method essentialy dictate that 1- it can't be instanciated, 2- Subclasses that are not abstract should implement the abstract methods in the super abstract class. You can have implemented methods or even final methods in an abstract class... I have to run now, my exam in is 2 hours wish me good luck
In option A "any final methods" can be taken as both abstract and non-abstatct method,but only non-abstract method can have final modiefier.that is y option A is not correct even though it contains the condition "may".Hope i am clear. regds Arpana
Joined: Oct 31, 2002
hi,Arpana I'm sorry I don't think so. I think the author regard the "may not" as "can't",so option A is wrong.