• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String Question

 
robl
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if("String".toString() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");
This prints Equal

if(" String ".trim() == "String")
System.out.println("Equal");
else
System.out.println("Not Equal");

This prints Not Equal - can somebody explain - thanks
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ...
Check out the following
discussion thread
 
robl
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks - I get it now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic