首页 > 自考
题目内容 (请给出正确答案)
[主观题]

以下代码的输出结果是什么? class Foo{ public static void main(String args[]){ int x=4,

以下代码的输出结果是什么? class Foo{ public static void main(String args[]){ int x=4,j=0; switch(x){ case 1:j++; case 2:j++; case 3:j++; case 4:j++; case 5:j++; break; default:j++; } System.out.println(j); } }()

A.1

B.2

C.3

D.编译错误

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“以下代码的输出结果是什么? class Foo{ publi…”相关的问题
第1题
以下的程序的调试结果为public class Scope{int i;public static void main(String argv[]){Scope s = new Scope();s.amethod();}public static void amethod(){System.out.println(i);}}

A. 输出结果为:0

B. 无输出

C. 编译错误

D. 输出null

点击查看答案
第2题
以下程序的运行结果为()public class IfTest{public static void main(String args[]){int x=3;

A.Not equal

B.Equal

C.无输出

D.编译出错

点击查看答案
第3题
给定以下程序段insert code public class foo {public static void main (String[] args) throws

给定以下程序段

insert code public class foo {

public static void main (String[] args) throws Exception {

printWriter ut = new PrintWriter (new java.io.outputStreamWriter (System.out), true) ;

out.printIn(“Hello”);

}

}

要使程序能正确运行,在insert code处必须添加()语句。

A、import java.io.PrintWriter;

B、include java.io.PrintWriter;

C、import java.io.OutputStreamWriter;

D、include java.io.OutputStreamWriter;

点击查看答案
第4题
当你编译运行下列程序代码,会得到什么结果?

private class Base{ Base(){ int i = 100; System.out.println(i); } }

public class Pri extends Base{ staticint i = 200;

public static void main(String argv[]){ Pri p = new Pri(); System.out.println(i); } }

A.这段代码不能通过编译

B.输出200

C.输出100和200

D.输出100

点击查看答案
第5题
给出下面代码,关于该程序以下哪个说法是正确的()?public class Person static in tarr=new
给出下面代码,关于该程序以下哪个说法是正确的()?public class Person static in tarr=new

给出下面代码,关于该程序以下哪个说法是正确的()?public class Person static in tarr=new int5;public static void main(Stringa)System.out.println(arr0);

A.编译时将产生错误

B.编译时正确,运行时将产生错误

C.输出零

D.输出空

点击查看答案
第6题
给出下面代码的输出()public class Test {public static void main(String[ ] args) {int[][]

A.0

B.1

C.2

D.4

点击查看答案
第7题
以下的程序的调试结果为?public class MyAr{public static void main(String argv[]) {MyAr m = new MyAr();m.amethod();}public void amethod(){static int i;System.out.println(i);}}

A. 输出结果为 0

B. 运行出错

C. 输出结果为 null

D. 编译错误

点击查看答案
第8题
以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i<4;i++) {if (i==3、break;System.out.print(i);}System.out.println(i);}}
以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i<4;i++) {if (i==3、break;System.out.print(i);}System.out.println(i);}}

A.0123 B.0122 C.123 D.234

点击查看答案
第9题

给出下面代码: public class Person{ static int arr[] = new int[10];public static void main(String a[]) {System.out.println(arr[1]); } } 那个语句是正确的()。

A.编译时将产生错误

B.编译时正确,运行时将产生错误

C.输出零

D.输出空

点击查看答案
第10题
以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public stati

以下程序调试结果为:

public class Test {

int m=5;

public void some(int x) {

m=x;

}

public static void main(String args []) {

new Demo().some(7);

}

}

class Demo extends Test {

int m=8;

public void some(int x) {

super.some(x);

System.out.println(m);

}

}

A.5

B.8

C.7

D.无任何输出

E.编译错误

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改