String i = "Hello World";
String j = "Hello World";
if(i==j)
{
System.out.println("i == j");
}
else
{
System.out.println("i != j");
}这个程序为什么执行结果是i==j?? 不是说“==”是比较引用,equals才是比较内容吗?
String j = "Hello World";
if(i==j)
{
System.out.println("i == j");
}
else
{
System.out.println("i != j");
}这个程序为什么执行结果是i==j?? 不是说“==”是比较引用,equals才是比较内容吗?
String i =new string( "Hello World");
String j = new String("Hello World");
如果 String i = new String("Hello World");
就不等了
谢谢楼主的提问!