String和Null串

空串(“”)是长度为0的字符串,是一个String对象。长度为0,没有内容。


String s = null; 与String s = “”;的区别

String s = null ,表示s引用不指向任何对象。在null值上调用方法会出现错误。
String s = “” ,表示s指向一个内容为空的String对象。