java第三章和第五章作业

第3章 数组

一、填空题

  1. 数组元素的下标总是从______开始。
  2. 对于数组int t[][]={{1,2,3},{4,5,6}}来说,t.length等于__2___,t[0].length等于__3___。
  3. 已知数组a的定义为“int a[]={1,2,3,4,5};”,则a[2]=____,数组b的定义为“int b[]=new int[5];”,则b[2]=_____,数组c的定义为“Object [] c=new Object[5];”,则c[2]=_____。
  4. 调用数组元素时,用___ 和  ____来唯一确定数组中的元素。

二、单选题

  1. 下列_____语句有错误
    1. int [] a;  B.int [] b=new int[10];  C. int []c=new int[];  D.int d[]=null;
  2. 下列____语句有错误
    1. A.int a[][]=new int[5][5];   B.int [][] b=new int[5][5];
    2. C.int []c[]=new int[5][5];   D.int [][]d=new int[5,5];
  3. 关于下面的程序,正确的结论是_____

public class Demo1{

public static void main(String [] args){

int a[]=new int[5];

boolean b[]=new boolean[5];

System.out.println(a[1]);

System.out.println(b[2]);

}

}

A.运行结果为0 false   B.运行结果为1 true

C.程序无法编译       D.可以通过编译但结果不确定

三、编程题

教材P50   4、8

第4章 封装与类

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值