下列语句片段: int result; int a=17,b=6; result=(a%b>4) ? a%b:a/b; System.out.println(result);
A.0
B.1
C.2
D.5
第1题:
下面的语句片段中,变量result结果为( )。 public class Test { public static void main (String args[ ]) { int sum=0; int r=2; iht result=(sum==1?sum:r); System. out. println (result); } }
A.1
B.2
C.10
D.0
第2题:
( 17 )下列程序的输出结果是
public class Test{
public static void main(String[] args){
int [] array={2,4,6,8,10};
int size=6;
int result=-1;
try{
for{int i=0;i<size && result==-1;i++}
if(array[i]==20) result=i;
}
catch(ArithmeticException e){
System.out.println( " Catch---1 " );
catch(ArrayIndexOutOfBoundsException e){
System.out.println( " Catch---2 " );
catch(Exception e){
System.out.println( " Catch---3 " );
}
}
A ) Catch---1
B ) Catch---2
C ) Catch---3
D )以上都不对
答案暂缺
第3题:
11、下列语句片段的结果为: int result; int a = 17, b = 6; result = (a % b > 4)? a % b : a / b ; System,out.println(result);
A.0
B.1
C.2
D.5
第4题:
A. 0
B. 1
C. 2
D. 5
第5题:
4.下面代码片断的输出结果是什么? byte b = 10; char c = 'b'; short s = 100; int i = 4, result1 = b * c; int result2 = ++i - b-- + s++; System.out.println("c=" + (byte) c); System.out.println("result1=" + result1); System.out.println("result2=" + result2);