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 Which statements are true? 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 "Which statements are true?" Watch "Which statements are true?" New topic
Author

Which statements are true?

Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
1) An abstract class is allowed to have non-abstract methods.
2) If a class has abstract methods, it must be declared abstract.
3) A non-abstract class is allowed to have abstract methods.
4) A non-abstract class is allowed to have abstract methods as long as those methods are also static.
My book says 1 & 2 are correct.
1 is obviously true and 4 is definately false. However, I felt that 2 was false because if a class extends a abstract class and overrides all abstract methods....it doesn't have to be abstract. And I felt that 3 was true for the same reason.
Correct me if I am wrong.
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Your books says true!

if a class extends a abstract class and overrides all abstract methods...

Then there is no abstract method in the subclass!.Since it gives implementation to abstarct methods in its super class by overriding.
Bye.
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
Okay. I see that now. I'll write a few of these scenarios to let it sink in.
Thanks.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
If a class has an abstract method, the class must be declared abstract so 3 is false.
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
Co-author Mike Meyers' Java 2 Certification Passport


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which statements are true?
 
Similar Threads
final and abstract
A question from JQPlus
Difference in Abstract classes and Interfaces
abstract class
scjp model questions