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

3下面程序段的输出结果为()。public class Test{int a, b;Test(){ a=100; b=200;} Test(int x, in

3下面程序段的输出结果为()。public class Test{ int a, b; Test() { a=100; b=200; } Test(int x, int y) { a=x; b=y; } public static void main(String args[]) { Test Obj 1 = new Test(12,45 ); System.out.println("a="+Obja+" b="+Objb); Test Obj2 = new Test(); System.out.println("a="+Obja+" b="+Objb); }}

A.a=100 b=200 a=12 b=45

B.a=12 b=45 a=100 b=200

C.a=12 b=200 a=100 b=45

D.a=100 b=45 a=12 b=200

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“3下面程序段的输出结果为()。public class Te…”相关的问题
第1题
关于以下程序代码的说明正确的是()(1) class HasStatic{(2) private static int x=100:(3) publi

关于以下程序代码的说明正确的是() (1) class HasStatic{ (2) private static int x=100: (3) public static void main (String args[]{ (4) HasStatic hs1=new Has Static(); (5) hs1.x + +; (6) Has Static hs2=new HasStatic(); (7) hs2.x + +; (8) hs1=new HasStatic(); (9) hs1.x + +: (10) System.out.println("x="+ x); (11) } (12) }

A.(5)行不能通过编译,因为引用了私有静态变量

B.(10)行不能通过编译,因为x是私有静态变量

C.程序通过编译,输出结果为:x=103

D.程序通过编译,输出结果为:x=100

点击查看答案
第2题
下面程序段的输出结果为()。pubUCClassTeS{public static voidmain(StringargS[]){booleaha,b,c;a

下面程序段的输出结果为()。 pubUCClassTeS { public static voidmain(StringargS[]) { booleaha,b,c; a=(3<5); b=(a==tme); System.Out.phntln("a="+a+"b="+b); c=(b==false); SyStem.out.println("b="+b+"C="+c); } }

A.a=tme b=falSe

B.a=true b=false b=true c=false b=true C=tme

C.a=true b=true

D.a=falSe b=false b=true c=falSe b=tme c=falSe

点击查看答案
第3题
3下面程序段的输出结果为()。mblic class Test public static void main(String args[]){boolean

3下面程序段的输出结果为()。 mblic class Test public static void main(String args[]) { boolean a,b,c; a=(3<5); b=(a==true); System.out.println("a="+a+"b="+b); c=(b=false); System.out.println("b="+b+"c="+c); } }

A.a=true b=false b=true c=false

B.a=true b=false b=true c=true

C.a=true b=true b=true c=false

D.a=false b=false b=true c=false

点击查看答案
第4题
下面程序的结果为 #include<iostream.h> int c; class A { private: int a; static int b; publi

下面程序的结果为

#include<iostream.h>

int c;

class A

{

private:

int a;

static int b;

public:

A() {a=0;c=0;}

void seta() {a++;}

void setb() {b++;}

void setc() {c++;}

void display() {cout < < a < < " " < < b < < " " < < c;}

};

int A: :b=0;

void main()

{

A a1,a2;

a1.seta() ;

a1.setb() ;

al .setc() ;

a2.seta() ;

a2.setb() ;

a2.setc() ;

a2.display() ;

}

A.1 2 1

B.1 2 2

C.1 1 2

D.2 2 2

点击查看答案
第5题
下面程序段的输出结果为Print"10+20="PrintlO+20Print"20+20="PrinflO+20A.10+20=30 20+20=40B.1

下面程序段的输出结果为 Print"10+20=" PrintlO+20 Print"20+20=" PrinflO+20

A.10+20=30 20+20=40

B.10+20= 30 20+20= 40

C.10+20 20+20

D.10+20=30 20+20= 40

点击查看答案
第6题
下面程序段的输出结果为public class MyClass{public static void main(String args[]){String s

下面程序段的输出结果为 public class MyClass { public static void main(String args[]) { String s="Helto! How are you?"; System.out.println(s.lastlndexOf("o",16)); } }

A.16

B.o

C.u

D.17

点击查看答案
第7题
下面程序段的输出结果为()。 A.a=true b=false b=true C=trueB.a=true b=false b=true

下面程序段的输出结果为()。下面程序段的输出结果为()。 A.a=true b=false b=true C=trueB.a=t

A.a=true b=false b=true C=true

B.a=true b=false b=true e=false

C.a=true b=true b=true C=false

D.a=false b=false b=true C=false

点击查看答案
第8题
若score分别赋值为99和77,下面程序段分别输出什么结果?ifscore>=90:print('A')elifsco

若score分别赋值为99和77,下面程序段分别输出什么结果?

ifscore>=90:

print('A')

elifscore>=80:

print('B')

elifscore>=70:

print('C')

elifscore>=60:

print('D')

else:

print('F')

点击查看答案
第9题
下列程序段的输出结果为()。A=0Print A+1A=3A.1B.-1C.3D.0

下列程序段的输出结果为()。 A=0 Print A+1 A=3

A.1

B.-1

C.3

D.0

点击查看答案
第10题
下列程序段的输出结果为()。int x=3,y=2;printf("%d",(x-=y,x*=y+8/5));

A.1

B.7

C.3

D.5

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