不能通过编译
通过编译,输出为:A B
通过编译,输出为:B
通过编译,输出为:A
第1题:
给出下列的程序,其叙述正确的是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
第2题:
给定如下JAVA程序片断下述程序将()。

A.不能通过编译
B.通过编译,输出为:AB
C.通过编译,输出为:B
D.通过编译,输出为:A
第3题:
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
第4题:
下面程序段的输出结果为 package test; public class 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 ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }
A.x=10
B.x-20
C.x=6
D.编译不通过
第5题:
以下程序的调试结果为?
public class Outer{
public String name = "Outer";
public static void main(String argv[]){
Inner i = new Inner();
i.showName();
}
private class Inner{
String name =new String("Inner");
void showName(){
System.out.println(name);
}
}
}
A.输出结果 Outer
B.输出结果 Inner
C.编译错误,因Inner类定义为私有访问
D.在创建Inner类实例的行出现编译错误
第6题:
A. 输出结果为 0
B. 运行出错
C. 输出结果为 null
D. 编译错误
第7题:
A. 输出结果为:0
B. 无输出
C. 编译错误
D. 输出null
第8题:
执行下面程序,输出的结果是?() public class Test{ public static void main(String[] args){ int a = 5; double b = 8; a = a++ + b; System.out.println(a); } }
第9题:
编译如下的Java程序片段: Class test{ Int count=9; Public void a(){ Int count=10; System.out,println(“count 1=” + count); } Public void count(){ System.out.println(“count 2 =”+ count); } Public static void main(String args[] ){ Test t=new Test(); t.a(); t.count(); } } 结果是()
第10题:
第4行编译报错
第5行编译报错
编译成功,输出13
编译成功,输出14
第11题:
不能通过编译
输出:count 1 =10 count 2=9
输出:count 1=9 count 2=9
第12题:
输出171.0
输出171
第2行和第5行编译报错
第10行编译报错
第13题:
下面程序段的输出结果为 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.编译不通过
第14题:
编译运行以下程序后,关于输出结果的说明正确的是( )。 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.编译错误
第15题:
当你编译运行下列程序代码,会得到什么结果?
private class Base{ Base(){ int i = 100; System.out.println(i); } }
public class Pri extends Base{ staticint i = 200;
public static void main(String argv[]){ Pri p = new Pri(); System.out.println(i); } }
A.这段代码不能通过编译
B.输出200
C.输出100和200
D.输出100
第16题:
类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
第17题:
以下程序调试结果为:
public class Test {
int m=5;
public void some(int x) {
m=x;
}
public static void main(String args []) {
new Demo().some(7);
}
}
class Demo extends Test {
int m=8;
public void some(int x) {
super.some(x);
System.out.println(m);
}
}
A.5
B.8
C.7
D.无任何输出
E.编译错误
第18题:
以下程序的编译和运行结果为?
abstract class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
A.amethod();
}
public void myfunc(){
System.out.println("My Func");
}
public void amethod(){
myfunc();
}
}
A.输出结果为 My Func
B.编译指示 Base 类中无抽象方法
C.编译通过,但运行时指示Base 类中无抽象方法
D.编译指示Base 类中的myfunc方法无方法体,没谁会喜欢该方法。
第19题:
以下的程序的执行结果为? () public class Demo{ public double getHeight(){ return 171.0; } public int getHeight (){ return 171; } public static void main(String[] args){ Demo demo = new Demo(); System.out.println(demo.getHeight()); } }
第20题:
给定如下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(); } } 上述程序将()。
第21题:
编译如下Java程序片断: class test{ int count = 9; public void a(){ int count=10; System.out.println("count 1 =" + count); } public void count(){ System.out.println("count 2 =" + count); } public static void main(String args[]){ test t=new test(); t.a(); t.count(); } } 结果将()。
第22题:
程序不能通过编译,因为没有import语句将Thread类引入
程序不能通过编译,因为Test类没有实现Runnable接口
程序通过编译,且运行正常,没有任何输出
程序通过编译,且运行正常,打印出一个"Hello"
第23题:
不能通过编译
输出: count 1 = 10 count 2 = 9
输出: count 1 = 9 count 2 = 9
第24题:
不能通过编译
通过编译,输出为:A B
通过编译,输出为:B
通过编译,输出为:A