public class TestStringArray {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] test = new String[2];
Integer testInteger = null;
String testString = String.valueOf(testInteger);
test[0] = "1";
test[1] = testString;
for (int i = 0; i < test.length; i++) {
if (test[i] == null) test[i] = "1";
System.out.println("--" + test[i] + "--");
}
}
}
输出结果:
--1--
--null--
String[] 中为null的问题
最新推荐文章于 2022-03-03 14:54:48 发布