首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

以下程序的运行结果为:public class A {static int k=3;public static void main(String[] args) {int k=4;A x1=new A();x1.k++;A x2=new A();x2.k++;k++;System.out.println(x1.k);}}

A. 3

B. 4

C.5

D.6

E.7

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“以下程序的运行结果为:public class A {sta…”相关的问题
第1题
以下程序的运行结果为()public class IfTest{public static void main(String args[]){int x=3;

A.Not equal

B.Equal

C.无输出

D.编译出错

点击查看答案
第2题
编译运行以下程序后,关于输出结果的说明正确的是()。 public class Conditional{ public static

编译运行以下程序后,关于输出结果的说明正确的是()。 public class Conditional{ public static void main (String args[]){ int x=2: System.out.println("value is”+ ((x<1)?2:2)); } }

A.输出结果为:valueis22.2

B.输出结果为:value is 2

C.输出结果为:value is 2.0

D.编译错误

点击查看答案
第3题
以下的程序的调试结果为?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. 编译错误

点击查看答案
第4题
以下程序的运行结果为:public class Test{public static void main(String argv[ ]){System.out.println("good"+"morning");}}

A. goodmorning

B. "good"+"morning"

C. good morning

D. good+morning

点击查看答案
第5题
以下程序的运行结果为:public class Test{public static void main(String argv[ ]){System.out.println("x="+ 5、;}}

A. 5

B. x=5

C. "x="+5

D. "x="5

点击查看答案
第6题
以下程序的编译运行结果为:1: public class Q102: {3: public static void main(String[] args)4

以下程序的编译运行结果为:

1: public class Q10

2: {

3: public static void main(String[] args)

4: {

5: int i = 10;

6: int j = 10;

7: boolean b = false;

8:

9: if(b = i == j)

10: System.out.println("True");

11: else

12: System.out.println("False");

13: }

14: }

A. 第9行出现编译错误;

B. 第9行出现运行错误;

C. 输出 True

D. 输出 False

点击查看答案
第7题
以下程序的运行结果为?class ValHold{public int i = 10;}public class ObParm{public static

以下程序的运行结果为?

class ValHold{

public int i = 10;

}

public class ObParm{

public static void main(String argv[]){

ObParm o = new ObParm();

o.amethod();

}

public void amethod(){

int i = 99;

ValHold v = new ValHold();

v.i=30;

another(v,i);

System.out.print(v.i );

}

public void another(ValHold v, int i){

i=0;

v.i = 20;

ValHold vh = new ValHold();

v = vh;

System.out.print(v.i);

System.out.print(i);

}

}

A.10030

B. 20030

C. 209930

D. 10020

点击查看答案
第8题
以下程序的运行结果为:public class test {public static void main(String args[]) {int i=0, j=2;do {i=++i;j--;} while(j>0);System.out.println(i);}}

A. 0

B. 1

C. 2

D.3

点击查看答案
第9题
以下程序的运行结果为?class xyz {public static void main(String args[]) {int i,j,k;for (i

以下程序的运行结果为?

class xyz {

public static void main(String args[]) {

int i,j,k;

for (i = 0; i< 3; i++) {

for(j=1; j< 4; j++) {

for(k=2; k<5; k++) {

if((i == j) && (j==k))

System.out.println(i);

}

}

}

}

}

A. 0

B. 1

C. 2

D. 3

E. 4

点击查看答案
第10题
以下程序的编译和运行结果为?abstract class Base{abstract public void myfunc();public void

以下程序的编译和运行结果为?

abstract class Base{

abstract public void myfunc();

public void another(){

System.out.println("Another method");

}

}

public class Abs extends Base{

public static void main(String argv[]){

Abs a = new Abs();

A.amethod();

}

public void myfunc(){

System.out.println("My Func");

}

public void amethod(){

myfunc();

}

}

A.输出结果为 My Func

B.编译指示 Base 类中无抽象方法

C.编译通过,但运行时指示Base 类中无抽象方法

D.编译指示Base 类中的myfunc方法无方法体,没谁会喜欢该方法。

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