can string be null in java

纯净搜索 为您找到 本页 5 条,用时 5.14 秒(数据源:360)

AI 回答 由 glm-4-flash 生成 · 仅供参考,请自行核实
1. 是的,在Java中,字符串(String)可以被赋予null值。
2. 当一个字符串变量被赋予null值时,意味着它不指向任何具体的字符串对象。
3. 尝试使用一个null字符串进行操作(如拼接、长度计算等)会导致NullPointerException。

java - String cannot be null? - Stack Overflow

最佳答案提问时间:2016年1月19日 - 4个回答 - 2If there's nothing in the fields, is the value not null? If there's nothing in the fields, the value will be "", which is not null...stackoverflow.com反馈
stackoverflow.com