This outputs-BPBPfalse.
I am really confused as to why the boolean is false when the string obviously is the exact same.
Why isnt it BPBPtrue?
Thanks in advance!
public class mySplit {
public static void main(String myString[])
{
String myString1= "BP+Car+Bird";
String myArray[] = {"BP","Car","Bird"};
String myArray2[]= myString1.split("\\+");
String A = myArray[0];
String B = myArray2[0];
System.out.print(A);
System.out.print(B);
boolean One = (A==B);
System.out.print(One);
}
}
OUTPUT - BPBPfalse