This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question about modifier" Watch "a question about modifier" New topic
Author

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>.
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?


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.....
why?please......
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.
regds
Arpana


SCJP1.4(91%)
dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
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.
 
wood burning stoves
 
subject: a question about modifier
 
Similar Threads
Polymorphism
An abstract class can not extend a concrete class?
abstract class
Abstract class
Abstract Methods