Thursday, October 13, 2005

What is the output of the following code?

public class StringExample{

public static void main(String []args){
String s="New";
String s1=s;
String s2="D";
String s3="New";

System.out.println(s==s1);
System.out.println(s3==s2);
System.out.println(s3==s1);

System.out.println(s1.equals(s1));
System.out.println(s3.equals(s2));
System.out.println(s3.equals(s1));

}
}

Ans :

true
false
true

true
false
true

5 Comments:

At 9:54 AM, Blogger Raymond said...

Any other blogs on this subject?
Ray at time share resale

 
At 10:59 AM, Blogger me said...

Hi Ashish. I don't normally bother with comments but feel a little bored today and am trying to waste a little time. I was just surfing around the net (actually looking for info on Time Share Resale) when I came across your blog. Just wanted to let you that I've gone back and read through some of your past posts. They caught my interest and I can relate to a quite a bit of what you say. So keep it up - I guess.

 
At 4:48 PM, Blogger allright said...

Hi Ashish. I don't normally bother with comments but feel a little bored today and am trying to waste a little time. I was just surfing around the net (actually looking for info on Time Share Resale) when I came across your blog. Just wanted to let you that I've gone back and read through some of your past posts. They caught my interest and I can relate to a quite a bit of what you say. So keep it up - I guess.

 
At 12:34 AM, Blogger allright said...

Hi Ashish. Hope you are well. I came across your site totally by accident. In fact it wasn't exactly on a topic I was looking for (I was on the lookout for Sell Time Share info). But as I was searching, one link led me to another and I got curious about your blog. I found it interesting and thought I'd drop you a line to tell you so. I guess thats what surfing is all about.

 
At 9:42 PM, Blogger me said...

Hi Ashish. I don't normally bother with comments but feel a little bored today and am trying to waste a little time. I was just surfing around the net (actually looking for info on Sell Time Share) when I came across your blog. Just wanted to let you that I've gone back and read through some of your past posts. They caught my interest and I can relate to a quite a bit of what you say. So keep it up - I guess.

 

Post a Comment

<< Home