Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

language and utilities expert level question

 
Dan Xu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what will be the output when the following code is compiled and run(assuming written inside main)?

String s1 = new String("amit");
String s3="arit";
String s2=s1.replace('m','r');
System.out.println(s2==s3);

why does it print out False?i think s2==s3 is ture.cos both of them are "arit".
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Link
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic