Created
December 24, 2019 00:55
-
-
Save upangka/fff517f48e41cc17e49346cb3f404686 to your computer and use it in GitHub Desktop.
null错误
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.caucoder.nullex; | |
public class NullString { | |
public static void main(String[] args) { | |
String str = null; | |
System.out.println(str); | |
System.out.println(str==null); | |
// ----------------------------- | |
System.out.println(String.valueOf(str)); | |
System.out.println(String.valueOf(str)==null); | |
} | |
} | |
/** | |
null | |
true | |
null | |
false | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment