This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference betwen reference variable & object  RSS feed

 
deepikakasi kasi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks 4 replying my doubt immediately...

How I got the doubt is that

INSTANCE OF-----Operator is nothing but Subclass object is assigned to super class refernce variable.....Is that Right???


In that I got the doubt of refernce variable & object


with lots of thanks & regards,
Deepika.K.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
INSTANCE OF-----Operator is nothing but Subclass object is assigned to super class refernce variable
I don't understand this statement.

The instanceof expression will evaluate to true when the object assigned to the given reference variable (the left hand of the expression) is an instance of the given (sub)class (the right hand of the expression).

Example:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!