Question: Hello, This is java A) the two strings refer to the same location or different locations? String oneStr = new String(tam); String twoStr = new

Hello, This is java

A) the two strings refer to the same location or different locations?

String oneStr = new String("tam");

String twoStr = new String("tam");

b) Why sometimes they are equal and not equal?

System.out.println(oneStr == twoStr)//false,

equalStrings = oneStr.equals(twoStr);

System.out.println(equalStrings); //true

System.out.println(oneStr.equals(twoStr)); //true

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!