System.out.println(args[0] == "x");
System.out.println(args[0].equals("x"));
String[] name = {"x"};
System.out.println(name[0] == "x");
System.out.println(name[0].equals("x"));
String[] hello = new String[1];
hello[0] = "x";
System.out.println(hello[0] == "x");
System.out.println(hello[0].equals("x"));
结果
false
true
true
true
true
true
当我调用“java classname x”时,为什么第一次测试会导致'false'?