1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-20 22:17:09 +08:00
This commit is contained in:
Charles Wu 2019-03-04 10:05:51 +08:00 committed by GitHub
parent 3c17922707
commit c7693078b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,7 +235,7 @@ JDK1.4中新加入的 **NIO(New Input/Output) 类**,引入了一种基于**通
**验证:** **验证:**
```java ```java
String s1 = new String("abc");// 堆内存的地 String s1 = new String("abc");// 堆内存的地
String s2 = "abc"; String s2 = "abc";
System.out.println(s1 == s2);// 输出false,因为一个是堆内存,一个是常量池的内存,故两者是不同的。 System.out.println(s1 == s2);// 输出false,因为一个是堆内存,一个是常量池的内存,故两者是不同的。
System.out.println(s1.equals(s2));// 输出true System.out.println(s1.equals(s2));// 输出true