[试题]

阅读下列程序段

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);

retum result;

}

public static void main(String args[]) {

OperatorsAndExpressions perAndExp=new OperatorsAndExpressions();

//条件表达式

OperAndExp.conditionalExpression(65);

}

}

其执行结果是[ ] 。

参考答案与解析:

相关试题

阅读下面程序 public class OperatorsAndExpressi

[单选题]阅读下面程序 public class OperatorsAndExpressions { void equalsMethodl(){ String s1=new String("how are you"); String s2=new String("how are you"); System.out.println(s1==s2); } public static void main(String args[]){ OperatorsAndExpressions perAndExp=

  • 查看答案
  • 阅读下面程序:public class OperatorsAndExpressi

    [单选题]阅读下面程序: public class OperatorsAndExpressions { void residual { int i=100,j=30; float m=563.5f,n=4.0f; System.out.println(i%j); System.out.println(m%n): } public static void main(String args[]) { OperatorsAndExpressions perAndExp=new OperatorsAndExpre

  • 查看答案
  • 请阅读下面程序public class OperatorsAndExpressi

    [单选题]请阅读下面程序 public class OperatorsAndExpressions { void residual() { int i=100, j=30; float m=563.5f, n=4.0f; System.out.println(i%j); System.out.println(m%n); } public static void main(String args[]) { OperatorsAndExpressions perAndExp=new OperatorsAndE

  • 查看答案
  • ( 8 )阅读下列程序段public class OperatorsAndExp

    [试题]( 8 )阅读下列程序段public class OperatorsAndExpressions {String conditionalExpression ( int score ) {String result;//如果 score 超过 60 分,则结果是 passed, 否则是 doesn't passresult= ( score>=60 ) ?"passed":"doesn't pass" :System.out.println ( result ) ;return

  • 查看答案
  • 阅读下面的程序段:public class Sun{public static

    [单选题]阅读下面的程序段: 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.3B.9C.14D.21

  • 查看答案
  • 阅读下面的程序段: publiC class Sun { public stat

    [单选题]阅读下面的程序段: 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.3B.9C.14D.21

  • 查看答案
  • 阅读下列程序public class VariableUse{public st

    [单选题]阅读下列程序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 未赋

  • 查看答案
  • 阅读下列程序public class VariableUse{public st

    [单选题]阅读下列程序 public class VariableUse{ public static void main(String[]args){ inta; if(a==8){ intb=9; System.out.println("a"="+a); System.out.println("b="+b); } System.out.println("a="+a); System.out.println("b="+b); } } 该程序在编译时的结果是( )。A.变量a未赋值B.第

  • 查看答案
  • 阅读下列程序:public class Test {public static

    [单选题]阅读下列程序: public class Test { public static void main (String args[]) { int x=3; for (int i=1;i<=10; i++) x=x+i/4; System. out. println(x);} }程序的输出结果是( )。A.12B.13C.14D.15

  • 查看答案
  • 阅读下面程序public class VariableUse { public

    [单选题]阅读下面程序 public class VariableUse { public static void main(String[] arqs) { 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.第

  • 查看答案
  • 阅读下列程序段public class OperatorsAndExpressi