After reading about Java String Pool I've decided to run a little test. I've written the following test program that it's result doesn't match the Java String Pool behavior according to the JDK specification.
public class Temp_20141220 {
private String b1 = "hello";
public static void main(String[] args) {
Temp_20141220 t = new Temp_20141220();
String b = "hello";
System.out.println("b==b1 =" + t.b1 == b);
}
}
I've been expecting to get in output: b==b1 =true but I got: b==b1 =false
Why so? Does Ubuntu's JVM not support this Java String Pool feature?