This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question about modifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question about modifier" Watch "a question about modifier" New topic

a question about modifier

dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
the question is from the book <Complete Java 2 Certification Study Guide>.
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.
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?

scjp 1.4<br />challenge haven't limit!
Alfred Kemety
Ranch Hand

Joined: Aug 14, 2002
Posts: 279
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

Alfred Raouf - Egypt - SCJP 1.4<br />Kemety.equals(Egyptian) // returns true
dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
but A says "may not",it doesn't say "must not"or "can't",so I think A is right.but.....
Arpana Rai
Ranch Hand

Joined: Nov 12, 2002
Posts: 93

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.

dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
I'm sorry I don't think so.
I think the author regard the "may not" as "can't",so option A is wrong.
I agree. Here's the link:
subject: a question about modifier
It's not a secret anymore!