自用 | bb选择题 assgn2(Classes, Objects, and Methods )

本文提供了一组关于Java编程中类、对象和方法的选择题及其解析,涉及类的方法顺序、对象数组、访问器方法、封装优势、参数传递、构造函数、源代码组织等核心概念。
摘要由CSDN通过智能技术生成

问题 1

The order of methods in a class is immaterial(无关紧要的).

A.false

B.true

问题 2

Given the declaration Circle[] x = new Circle[10], which of the following statement is most accurate?

A.x contains a reference to an array and each element in the array can hold a Circle object.

B.x contains an array of ten int values.

C.x contains a reference to an array and each element in the array can hold a reference to a Circle object(对圆对象的引用).

D.x contains an array of ten objects of the Circle type. 

问题 3

Suppose you wish to provide an accessor method(访问器方法) for a boolean property(布尔属性) finished, what signature of the method should be?

A.public void isFinished()

B.public void getFinished()

C.public boolean getFinished()

D.public boolean isFinished()

问题 4

If the parameter is of a primitive type(基元类型), both formal parameter(形式参数) and actual parameter(实际参数) reference to the same memory.(如果参数是基元类型,则形式参数和实际参数都引用同一内存)

A.false

B.true 

问题 5

 What is the printout for the first statement in the main method?

public class Test {

  private int i = 0;

  static int j = 0;



  public static void main(String[] args) {

    new Test();

  }



  public Test() {

    i++;

    j++;

    i
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值