这是我的代码:
public static void main(String[] arg)
{
String x = null;
String y = "10";
String z = "20";
System.out.println("This my first out put "+x==null?y:z);
x = "15";
System.out.println("This my second out put "+x==null?y:z);
}
我的输出是:
20
20
但我期待这个:
This my first out put 10
This my second out put 20
有人可以解释一下为什么两个 println 调用的输出都为“20”吗?