执行下面程序,输出的结果是?() public class Test{ public static void main(String[] args){ int a = 5; double b = 8; a = a++ + b; System.out.println(a); } }
第1题:
阅读下列代码
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 )输出空
第2题:
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}
A.编译错误
B.0
C.1
D.运行成功,但不输出
第3题:
A.第4行编译报错
B.第5行编译报错
C.编译成功,输出13
D.编译成功,输出14
第4题:
给出下面的程序: public class ex49 { static int arr[] = new int[10]; public static void main(String args [] ) { System.out.println (art [1] ); } } ______叙述是正确的。
A.编译时将发生错误
B.输出为 null
C.输出为0
D.编译时正确但是运行时出错
第5题:
对于下面一段代码的描述中,正确的是______。 public class ex36 { public static void run main(String[] args) throws Excepion { method(); } static void method() throws Exception try { System.out.println("test"); } finally { System.out.println ("finally"); } } }
A.代码编译成功,输出“test”和“fmally”
B.代码编译成功,输出“test”
C.代码实现选项A中的功能,之后Java停止程序运行,抛出异常,但是不进行处理
D.代码不能编译
第6题:
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }
A.编译错误
B.0
C.1
D.运行成功,但不输出
第7题:
阅读下面代码 public class Person { static int arr[]=new int[10]; public static void main(String args) { System.out.println(arr[9]); } } 该代码的运行结果是
A.编译时将产生错误
B.编译时正确,运行时将产生错误
C.输出零
D.输出空
第8题:
下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { for ( int a=0;a<10;a++) { if (a==5) break; System.out.println(A); } } }
A.01234
B.6789
C.012346789
D.5
第9题:
下列代码的执行结果是( )。
public class Test{
public int aMethod( ){
static int i=0;
i++;
System.out.println(i):
}
public static void main (String args[]){
Trest test=new Test ( );
test aMethod( ):
}
}
A.编译错误
B.0
C.1
D.运行成功,但不输出
B.
C.
D.
第10题:
类A及其派生类B定义如下:class A{ public int getInfo(int a) { return a; }}public class B extends A{ public float getInfo(int b) { return b; } public static void main(String[]args) { A a=new A(); B b=new B(); System.out.println(a.getInfo(3)+","+b.getInfo(5)); }}关于上述程序代码的叙述中正确的是 ( )
A.第10行不能通过编译
B.程序通过编译,输出结果为:3,3
C.程序通过编译,输出结果为3,5
D.程序通过编译,输出结果为:5,5