填空题

import acm.program.ConsoleProgram;

public class Test extends ConsoleProgram {

    public static int K= 10;

    public void run() {

        switch (K) {

        default:

            println("没有值");

        case 1:

            println("一");

        case 10:

            println("十");

        case 5:

            println("五");

        }

    }

}

当你试图编译和运行以上程序,将会发生什么?



编译时错误.

在"十" 之后输出 "五" 正确.

输出"十".

通过编译,但因为default语句位置上的错误会出现运行时错误.

an incorrect answer.

the correct answer.

an incorrect answer.

下载APP答题
由4l***zm提供 分享 举报 纠错
相关题库推荐

相关试题

判断题 在卡雷尔程序中,程序员不能创造新的指令。

A、正确
B、错误

判断题 条件判断语句不能嵌套使用。

A、正确
B、错误

判断题 SuperKarel是Karel的父类。

A、正确
B、错误

判断题 在卡雷尔程序中,run方法是一个入口程序。

A、正确
B、错误

判断题 在卡雷尔程序中常见的错误有两种:无限循环和差一错误。

A、正确
B、错误

判断题 for循环和while循环的语法结构完全一样,可以在任何情况下替换使用

A、正确
B、错误

判断题 Superkarel类是由Karel类扩展来的。

A、正确
B、错误

判断题 在创建一个新方法时,方法前面的修饰符只能使用private。

A、正确
B、错误