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

(8 )阅读下列程序段public class OperatorsAndExpressions {String conditionalExpression (in

(8 )阅读下列程序段

public class OperatorsAndExpressions {

String conditionalExpression (int score ) {

String result;

//如果 score 超过 60 分,则结果是 passed, 否则是 doesn't pass

result= (score>=60 ) ?"passed":"doesn't pass" :

System.out.println (result ) ;

return result;

public static void main (String args[] ){

OperatorsAndExpressions perAndExp=new OperatorsAndExpressionsQ;

//条件表达式

OperAndExp. conditionalExpression (65 ) ;

}

}

其执行结果是 【 8 】

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“(8 )阅读下列程序段public class Operat…”相关的问题
第1题
阅读下列一个支持多线程并发操作的堆栈类代码段public class MyStack{private int idx=0;private

阅读下列一个支持多线程并发操作的堆栈类代码段 public class MyStack{ private int idx=0; private int[]data=new int[8]; public______void push(int i){ data[idx]=i; idx + +; } …… } 在下画线处应填入的是

A.synchronized

B.wait

C.blocked

D.interrupt

点击查看答案
第2题
阅读下列代码段。 class Test implements Runnable{ public int run{ int i=0: while(true){ i+

阅读下列代码段。 class Test implements Runnable{ public int run{ int i=0: while(true){ i++: System.OUt.println("i="+i); } } } 上述代码的编译结果是()。

A.程序通过编译并且run方法可以正常输出递增的i值

B.程序通过编译,调用run方法将不显示任何输出

C.程序不能通过编译,因为while的循环控制条件不能为“true”

D.程序不能通过编译,因为run方法的返回值类型不是void

点击查看答案
第3题
阅读下列程序段,不合法的行是______。class Computer{}class Monitor extends Computer{}class Ha

阅读下列程序段,不合法的行是______。 class Computer{} class Monitor extends Computer{} class HardDrive extends Computer { public void test() { Monitor a = new Monitor(); Computer b = new Monitor(); HardDrive c = (HardDrive) a; Monitor d = b; } } ①Monitor a = new Monitor(); ②Computer b = new Monitor(); ③HardDrive c = (HardDfive)a; ④Monitor d = b;

A.①②③

B.③④

C.①③④

D.②④

点击查看答案
第4题
阅读下列程序public class VariableUse{public static void main (String[] args) {int a;i

阅读下列程序

public class VariableUse{

public static void main (String[] args) {

int a;

if (a==8) {

int b=9;

System.out.println(“ a = ” +a);

System.out.println(“ b = ” +b);

}

System.out.println(“ a = ” +a);

System.out.println(“ b = ” +b);

}

}

该程序在编译时的结果是

A )变量 a 未赋值

B )第二个 System.out.println(“ b = ” +b) 语句中,变量 b 作用域有错

C )第二个 System.out.println(“ a = ” +a) 语句中,变量 a 作用域有错

D )第一个 System.out.println(“ b = ” +b) 语句中,变量 b 作用域有错

点击查看答案
第5题
下列程序段执行后,变量c的值为()。 public class Test {public static void main(String[ ] arg

下列程序段执行后,变量c的值为()。 public class Test { public static void main(String[ ] args) { float a=10, b=9, c=8; if (--a==B)c= --a/c; System. out. println (C); } }

A.1.125

B.1.0

C.1.25

D.0.0

点击查看答案
第6题
下列程序段执行后,x5的结果是______。public class ex42{ public static void main(String[]args)

下列程序段执行后,x5的结果是______。 public class ex42 { public static void main(String[] args) { int xl = 8; int x2 = 12; int x3=7; int x4; int x5; x4 = x1 > x2 ? x1 : x2+ x1; x5 = x4 > x3 ? x4 : x3; System.out.println(x5); } }

A.11

B.20

C.10

D.12

点击查看答案
第7题
阅读下面的程序段: publiC class Sun { public static void main (Stringargs[]) { int a=0; for

阅读下面的程序段: publiC class Sun { public static void main (String args[ ]) { int a=0; for(int i=1;i<=3;i++) { for(int j=1;j<=i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) ; } } 执行上面的3重循环后,a的值为()。

A.3

B.9

C.14

D.21

点击查看答案
第8题
阅读和理解下面程序段:class Manager extends Employee{public Manager(String n,double s,int y

阅读和理解下面程序段: class Manager extends Employee{ public Manager(String n,double s,int year,int month,int day){ super(n,S,year,month,day); bonus=0; } public double getSalary(){ double baseSalary=super.gerSalary(); return baseSalary+bonus; } public void setBonus(double B) {bonus=b; } private double bonus; } Manager是Employee的子类,其理由是()。

A.Manager的适用范围较宽

B.extends关键字声明

C.Manager的域减小了

D.雇员是一个经理

点击查看答案
第9题
(18 )请阅读下面程序/.public class ForLoopStatement {public static void main (String[] ar

(18 )请阅读下面程序/.

public class ForLoopStatement {

public static void main (String[] args ){

int I,j :

for (i=l;i<5;i++ ){ //i 循环

for (j=1;j<=i;j++ ) //j 循环

System.out.print (i+" X "+j+ ” = +i*j+" ” );

System.out.println () ;

}

程序完成后, i 循环和 j 循环执行的次数分别是

A ) 4 , 10

B ) 8 , 9

C ) 9, 8

D ) 10 , 10

点击查看答案
第10题
阅读下面实现堆栈类并发控制的部分代码 public class DataStack{ private int idx=0; private in
t[]data=new int[8]; public void push(int i){ . ________________{ data[idx]=i; idx + +; } } } …… } 在程序下画线处填入正确选项是

A.synchronized

B.synchronized(this)

C.synchronized()

D.synchronized(idx)

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