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
Get step-by-step solutions from verified subject matter experts
