Get your CodeRanch badge!*
The moose likes Beginning Java and the fly likes what about Interface Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what about Interface Type" Watch "what about Interface Type" New topic
Author

what about Interface Type

Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 141
Hi..
My dout is .... The compiler checks the class of the reference type -not the object type -to see if you can call a method using that reference .
so what about the interfece reference type?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

raj chiru wrote:Hi..
My dout is .... The compiler checks the class of the reference type -not the object type -to see if you can call a method using that reference .
so what about the interfece reference type?


Raj,
Same strategy for interface as well ( as with class)
Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 141
balu..Thanks for reply

But interfaces are abstract
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Raj,

Yes , Abstract classes cannot be instantiated , but it can call its own methods using its subclass objects. (polymorphism comes to picture here.)

 
Consider Paul's rocket mass heater.
 
subject: what about Interface Type
 
Similar Threads
down cast only throw exception
Inheritance/Polymorphism question
Following code shows ClassCastException
equals() doubt
Why is the output 10? Not 20?