Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what about Interface Type

 
Raj chiru
Ranch Hand
Posts: 142
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 142
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
balu..Thanks for reply

But interfaces are abstract
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Raj,

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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic