选择题数组

public class TestString {

public static void main(String[] args) {
String [] s =new String[10];
String s1 = s[9];
String s2 = s[0];
System.out.println("s1:"+s1);//null
System.out.println("s2 s[0]:"+s2);//null
System.out.println("s.length:"+s.length);//10
}

}
注意:
s[10] 错误,数组下标越界异常。

猜你喜欢

转载自www.cnblogs.com/2016-cxp/p/10995639.html