aspose file tools
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
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: 182

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: 42954
    
  73
Why wouldn't it be allowed?
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 182


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: 19956
    
  25

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java interface