下列程序的输出结果是boolean[]b=newboolean[1];System.out.println(b[0]);
举一反三
- boolean []b=new boolean[5];System.out.println(b[0]);运行上述程序段,输出 。
- 分析以下代码:publicclassTest{publicstaticvoidmain(String[]args){boolean[][]x=newboolean[3][];x[0]=newboolean[1]; x[1]=newboolean[2];x[2]=newboolean[3];System.out.println("x[2][2] 为 "+x[2][2]);}} A: 程序有一个编译错误,因为newboolean[3][]是错误的。 B: 程序有运行时错误,因为x[2][2]为null。 C: 程序运行并显示x[2][2]为null。 D: 程序运行并显示x[2][2]为true。 E: 程序运行并显示x[2][2]为false。
- ls=[ [1,2,3,4],['a','b','c','d'],['列','表'] ][br][/br] 请写出结果: ls[0] (1) ls[0][0] (2) ls[1][0:2] (3)
- 下列程序段的输出结果是 a = [1,2,3,4,5] b = a c = a[:] b[1] = 6 c[2] = 5 print(a[0]+a[1]+a[2])
- 定义如下矩阵a,b,则选项中输出结果与b矩阵相同的是_______。 a = np.mat([[0,1],[2,3]]) b = np.mat([[1,0],[0,1]])