给定如下Java程序片断: class A{ public A (){ System.out.println("A"); } } class B extends A{ public B(){ System.out.println("B"); } public static void main(String[] args){ B b=new B(); } } 上述程序将()。
第1题:
阅读下列代码后 public class Person{ int arr[]=new int[10]; public static void main(String args[]){ System.out.println(arr[1]); } } 正确的说法是( )。
A.编译时将产生错误
B.编译时正确,运行时将产生错误
C.输出零
D.输出空
第2题:
给出下列的程序,其叙述正确的是public class Man { static int arr[]= new int [10]; public static void main (String a []){ System.out.println(arr[1]); }}
A.编译时将发生错误
B.编译时正确但是运行时出错
C.输出为0
D.输出为null
第3题:
A.不能通过编译
B.通过编译,输出为:AB
C.通过编译,输出为:B
D.通过编译,输出为:A
第4题:
编译运行以下程序后,关于输出结果的说明正确的是( )。 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.编译错误
第5题:
下面程序段的输出结果为 package test; public class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println(”x=”+b.x); } } class Class B { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }
A.x=10
B.x=20
C.x=6
D.编译不通过
第6题:
阅读下列代码
Public class Person{
Static int arr[ ] = new int (10);
Public static void main (String args ) {
System.out.println(arr[9]);
}
}
该代码运行的结果是
A )编译时将产生错误
B )编译时正确,运行时将产生错误
C )输出 0
D )输出空
第7题:
编译运行下程序后,关于输出结果的说法正确的是( )。 public class conditional{ public smile void main(string args[]){ int x=4; System.out.println("alue is "+((x>4)?99:9)); } }
A.输出结果为 value is 99.99
B.输出结果为 value is 9
C.输出结果为 valueis9.0
D.编译错误
第8题:
阅读下面的程序: public class Person{ int arr[ ]=Hew int[10]; public static void main(String args[ ]){ System.out.println(arr[1]); } } 正确的说法是______。
A.编译时将产生错误
B.编译时正确,运行时将产生错误
C.输出为0
D.输出为空
第9题:
给定如下JAVA程序片断下述程序将()。
A.不能通过编译
B.通过编译,输出为:AB
C.通过编译,输出为:B
D.通过编译,输出为:A
第10题:
2给出下列的程序,其叙述正确的是( )。public class Man{static int arr[]=new int[10];public static void main(String args[]){System.out.println (arr[1=];}}
A.编译时将发生错误
B.编译时正确但是运行时出错
C.输出为0
D.输出为null