hi Sagar, I think you are not fully familiar with the String mechanism of java. java creates a String pool for storage of String literals. when you write if(b1.toString()==b1.toString()) call to first function returns a string reference in the pool. same with the second one, it returns another string reference in the pool since the references are different, the if return false. if you use .equals() to compare them you will get true. i think its clear to you now
Please don't post the same question in multiple forums - it wastes our time to reply to questions when there's already a perfectly good answer in another forum. I'm closing this thread - see duplicate in JiG Beginner.
"I'm not back." - Bill Harding, Twister
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...