wood burning stoves 2.0*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 178
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
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Why wouldn't it be allowed?


Ping & DNS - updated with new look and Ping home screen widget
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178

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: 19541
    
  16

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
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java interface
 
Similar Threads
Interface
Low coupling??
Testing of data class instance(s)
abstract class inplementing an interface
how to prevent overriding method?