• Post Reply Bookmark Topic Watch Topic
  • New Topic

String object declaration problem  RSS feed

 
MohamedSalim malik
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In my SCJP class they taught us like Strings are considered as Objects in java.. If so the above s1,s2 should be two references which points to TWO OBJECTS . Am i correct.?
But when i compile and run this i got a result showing true. I am confused


then i made another program..




When i run this, it showed the boolean value as 'false'. It indicates that this is two different objects.(is that correct?) My question is that, which is considered as
a OBJECT in java From above two declarations.?? can someone explain me?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a Journal article about Strings and the String pool. Check it here.
 
MohamedSalim malik
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome artical.. now i got it.. thanks for your help.. :
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!