public class HelloWorld {
public static void main(String[] args) {
//基本数据类型int
int a = 0;
int b = 0;
System.out.println(a == b); //true
//引用数据类型String
String c = new String("hello");
String d = new String("hello");
System.out.println(c == d); //false
System.out.println(c.equals(d)); //true
String e = "world";
String f = "world";
System.out.println(e == f); //true
System.out.println(e.equals(f)); //true
}
}
// 参考https://www.cnblogs.com/dolphin0520/p/3592500.html
网友评论