1.最大的区别在于String str=null没有分配内存,String str=""分配了内存
2.String str=null 这个引用指向了一个null ,没有地址没有值的地方
3,String str="" 这个引用指向了一个地址,地址里面存的是空的字符
本文共 185 字,大约阅读时间需要 1 分钟。
1.最大的区别在于String str=null没有分配内存,String str=""分配了内存
2.String str=null 这个引用指向了一个null ,没有地址没有值的地方
3,String str="" 这个引用指向了一个地址,地址里面存的是空的字符
转载于:https://www.cnblogs.com/liuhuimh/p/7224377.html