techpalle;
public class MyProgram {
public static void main(String[] args) {
System.out.println("Tri" + "angle" =="Triangle");
}
}
Tri is stored in string constant pool, angle is also stored in string constant pool and after concatenation is done Triangle will be stored in heap memory.
Right Hand Side Triangle will be stored in string constant pool
==
compares the address
How am I getting true then?