Difference between null and empty (“”) Java String

前端 未结 22 1707
再見小時候
再見小時候 2020-11-22 17:10

What is the difference between null and the \"\" (empty string)?

I have written some simple code:

String a = \"\";
String b         


        
22条回答
  •  深忆病人
    2020-11-22 17:48

    String is an Object and can be null

    null means that the String Object was not instantiated

    "" is an actual value of the instantiated Object String like "aaa"

    Here is a link that might clarify that point http://download.oracle.com/javase/tutorial/java/concepts/object.html

提交回复
热议问题