Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

equals Method  RSS feed

 
sivanagaswathi kallam
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If someone can explain thebelow code it would be very helpful to me.

 
Paweł Baczyński
Bartender
Posts: 2054
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, UseCodeTags (this is a link) when posting.
I have added them for you this time. Doesn't it look better.

What is about this method that you don't understand?

You should know that this method is written in a wrong way as it might throw NullPointerException.

Also, don't write:Write:
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sivanagaswathi kallam wrote:If someone can explain thebelow code it would be very helpful to me.

I'm not sure it would, because it's wrong.

What happens if that
  if (obj instanceof Emp)
test returns false?

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!