• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which statements are true?

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Mike Cunningham
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay. I see that now. I'll write a few of these scenarios to let it sink in.
Thanks.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic