Topic: 数组练习题(附答案)

  Print this page

1.数组练习题(附答案) Copy to clipboard
Posted by: yyfr
Posted on: 2004-05-28 13:13

What will happen if you try to compile and run the following code?(3)
public class Q {
public static void main(String argv[]){
int anar[]=new int[]{1,2,3};
System.out.println(anar[1]);
}
}
1) 1
2) Error anar is referenced before it is initialized
3) 2
4) Error: size of array must be defined

What will happen if you try to compile and run the following code?(3)
public class Q {
public static void main(String argv[]){
int anar[]=new int[5];
System.out.println(anar[0]);
}
}
1) Error: anar is referenced before it is initialized
2) null
3) 0
4) 5

2.Re:数组练习题(附答案) [Re: yyfr] Copy to clipboard
Posted by: breezehou
Posted on: 2004-05-28 14:47

比较简单

3.Re:数组练习题(附答案) [Re: yyfr] Copy to clipboard
Posted by: yyfr
Posted on: 2004-05-29 08:36

是啊,基础的


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923