consider the following code segment
String a="hello";
String b= "hello";
if (a==b)
System.out.println("they are equal");
i ) Why does it not generate output?
ii)How can we rewrite the program such that it will print the output?
consider the following code segment
String a="hello";
String b= "hello";
if (a==b)
System.out.println("they are equal");
i ) Why does it not generate output?
ii)How can we rewrite the program such that it will print the output?
Did you execute that code?
I thought not.
Try running it - it does generate the output they are equal
It looks like you are asking the wrong question.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.