• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

OCA 8 - concrete class must inherit abstract methods

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya everyone,

I have a question from the OCA study guide, chapter 5 question 15:

Which of the following is true about concrete subclass?
b. A concrete subclass must implement all inherited abstract methods.
c. A concrete subclass must implement all methods defined in an inherited interface.


I don't understand why option B is correct whilst C is incorrect. According to the book option C is incorrect because a superclass could have implemented the methods. But wouldn't the same also apply to option B? All methods in interfaces are abstract and they can could be implemented by the superclass (whether concrete or even abstract) rather than the subclass. Would someone be able to explain this one?


Thanks.

 
Ranch Hand
Posts: 271
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya,

The key is what makes an (inheriting) subclass concrete?  A lack of undefined methods makes a subclass concrete.  Option B has a laser focus on defining only the undefined methods.  Whereas Option C blindly assumes that even if undefined methods were defined in one or more middle classes, that these undefined methods would still need to be again redefined for an (inheriting) concrete subclass.  This would not make sense of course, because once a method has initially been defined, then that method is no longer abstract because the method is no longer undefined.

I hope that helps,
Charles
 
Saloon Keeper
Posts: 3304
146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, not to forget, C talks about ALL methods in the interface. But default and static methods already have an implementation.

Question: can you override a static method? If not, how is this called?
 
Ranch Foreman
Posts: 60
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet, if I may, I'd like to give it a shot  

I'm also preparing for my OCA certification exam.

Static methods cannot be overridden, but it leads to method hiding?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!