It's not a secret anymore!
The moose likes Beginning Java and the fly likes Java interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java interface" Watch "Java interface" New topic
Author

Java interface

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186

Dear Friends,

While implementing an interface is it possible to give the implemented method as final in the implementing class?





Because in the eclipse editor this is not giving any compiler error. If this is possible why this is allowed?

Thanks & Regards,
Vijay
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
Why wouldn't it be allowed?
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186


interface methods are implicitly public / abstract. So i couldn't understand the concept of allowing final in the implementation of public / abstract method.


Kindly provide me a clarification.

Thank you very much.

Regards,
Vijay
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20044
    
  30

They're abstract in the interface. As soon as they are implemented they are no longer abstract in the implementing class.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: Java interface
 
jQuery in Action, 3rd edition