学开网

国开网100万+专项题库

使用积分解锁答案,让你的形成性考核不再困难。

访
未登录
当前积分 -
单选题

下列循环语句实现先执行后判断循环条件的是( )。

  • while

  • do-while

  • for

  • switch-case

单选题

在switch-case语句中,需要与( )语句搭配使用,用以结束对应case逻辑的执行。

  • continue

  • break

  • while

  • if-else

单选题

下列代码段,输出“default”的m的值( )。
public class Test1{
  public static void main(String args[]){
  int m;
  switch(m){
  case 0:System.out.println("case 0");
  case 1:System.out.println("case 1");break;
  case 2: break;
  default: System.out.println("default");
  }
 }
}

  • 0

  • 1

  • 2

  • 3

单选题

下列代码段, x处于( )范围时将打印字符串"second" 。
if(x>0){ System.out.println("first"); }
else if(x>-3){ System.out.println("second"); }
else { System.nut.println("third"); }

  • x>0

  • x>-3

  • x<=-3

  • x<=0&&x>-3

单选题

下列数据类型中,switch语句不能用于的是( )。

  • double

  • byte

  • short

  • char

单选题

类内部内容不包括( )。

  • 属性信息

  • 外部类的私有方法调用

  • 方法声明

  • 构造方法声明

  • 属性定义

单选题

下列关于类方法的描述,错误的是( )。

  • 类方法可使用关键字static作为修饰符

  • 类方法和实例方法均占用内存空间,类方法在未实例化之时,不占用内存空间

  • 类方法能用实例和类名调用

  • 类方法只能处理类变量或调用类方法

单选题

下列( )不是修饰符。

  • static

  • final

  • abstract

  • void

  • public

  • char

  • native

单选题

下列修饰符( )修饰的变量称为静态变量,修饰的方法称为静态方法。

  • synchronized

  • native

  • static

  • abstract

单选题

对于下列代码段,说法正确的是( )。
public class Student {
private String name;
private int age;
public Student() {
this("李红", 25);
}
public Student(String curName, int curAge) {
this.name = curName;
age = curAge;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return this.getName() + "," + this.age;
}
………
}

  • name 和 age 是两个构造方法的入口参数

  • 通过this.name 调用了方法name

  • 通过this("李红", 25) 调用了构造方法

  • 通过age 调用了方法age