aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can we mark an overriding method as abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Can we mark an overriding method as abstract" Watch "Can we mark an overriding method as abstract" New topic
Author

Can we mark an overriding method as abstract

Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183

Can we mark an overriding method as abstract ?


Cannot understand how the code in class B works. Why would we want to do this
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 14606

Simran Dass wrote:
Cannot understand how the code in class B works. Why would we want to do this


Basically, you want to create a new class that IS-A a particular sub class, but you don't have the complete implementation. Or you have multiple possible implementations, of which the subclass implementation is not one of them.

Granted, it is not a common case, but it can happen.

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Simran Dass
Ranch Hand

Joined: Jan 09, 2010
Posts: 183

Yeah. Thanks for the quick reply.
Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 767
In what cases, such a scenario can happen? I find this quiet meaningless. Umm that too marking an instance method as abstract.
Doesn't it violate the rules of overriding?

Best Regards,


Prithvi/Beenish,
My Blog, Follow me on Twitter,Scjp Tips, When you score low in mocks, Generics,Scjp Notes, JavaStudyGroup
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 747

This code if fine, but useless and I think that it violates the LSP principle a little, but it depends on the interpretation.


SCJP6, SCWCD5, OCE:EJBD6.
 
 
subject: Can we mark an overriding method as abstract
 
Threads others viewed
Why i can't access to te interface method?
abstract method implementation
Question about overriding : from ExamLab practice test no 2
abstract method overriding
Touchscreen Apps on Android
developer file tools