• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String Output related.

 
Pinki Roy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I do not understand why this is giving the output of False. Please explain.
 
Joe Harry
Ranch Hand
Posts: 10080
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a good chance for you to explore a little bit and understand the ideas behind reference equality, object equality and perhaps String immutability.
 
Rahul Shinde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The String class is immutable, once it is created a String object cannot be changed.

You might want to do .equals() instead to check for contents. i.e.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic