String r1 = "hello";
String r2 = "hello";
System.out.println("Result: " + r1 == r2);
I tried running this code and i am not getting the String output in the console. The only value getting printed is the r1==r2 result i.e false.
The question here is I am expecting the output to be "Result: false" and why is false just getting printed.
Also i understand that .equals should be used, I just wanted to know why the result is such in the given scenario.
It would be great if some one can point to relevant documentation and help why this is the behaviour.