网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
A派生出子类B,B派生出子类C,并且在Java源代码中有如下声明:1.A  a0=new  A(); 2.A  a1=new B(); 3.A  a2=new C();问以下哪个说法是正确的?()
A

只有第1行能通过编译

B

第1、2行能通过编译,但第3行编译出错

C

第1、2、3行能通过编译,但第2、3行运行时出错

D

第1行、第2行和第3行的声明都是正确的


参考答案

参考解析
解析: 暂无解析
更多 “单选题A派生出子类B,B派生出子类C,并且在Java源代码中有如下声明:1.A  a0=new  A(); 2.A  a1=new B(); 3.A  a2=new C();问以下哪个说法是正确的?()A 只有第1行能通过编译B 第1、2行能通过编译,但第3行编译出错C 第1、2、3行能通过编译,但第2、3行运行时出错D 第1行、第2行和第3行的声明都是正确的” 相关考题
考题 对下列程序的叙述中,正确的是1:public class X extends Thread implements Runnable{2:publ主c void run(){3: System.out.println(“this is run()”);4:}5:public static void main(String args〔〕){6:Threadt二new Thread(new X());7:t.start();8:}9:}A.第1行会产生编译错误B.第6行会产生编译错误C.第6行会产生运行错误D.程序正常运行

考题 编译并运行以下程序,以下描述哪个选项是正确的()A、编译通过运行无异常B、编译通过但运行时出错C、2出错,不能成功编译D、不能成功编译,行3出错

考题 现有:interfaceI{voidgo();}abstractclassAimplementsI{}classCextendsA{voidgo(){}}结果是什么?() A.代码通过编译B.由于第1行的错误导致编译失败C.由于笫3行的错误导致编译失败D.由于第6行的错误导致编译失败

考题 编译并运行以下程序,以下描述哪个选项是正确的_________。1.classa{2.protectedstringtostring(){3.returnsuper.tostring();}4.} A.不能成功编译,行3出错B.行2出错,不能成功编译C.编译通过但运行时出错D.编译通过运行无异常

考题 对下列程序的叙述中,正确的是( )。 A.第1行会产生编译错误B.第6行会产生编译错程SXB 对下列程序的叙述中,正确的是( )。A.第1行会产生编译错误B.第6行会产生编译错程C.第6行会产生运行错误D.程序正常运行

考题 若程序中有以下说明和定义。struct abc{ int x;char y;}struct abc s1,s2;则会发生的情况是A.编译时出错 B.程序将顺序编译、连接、执行C.能顺序通过编译、连接,但不能执行 D.能顺序通过编译,但连接出错

考题 关于以下代码段的说法中正确的是( )。 (1)String s="abcde"; (2)StringBuffer s1=new StringBuffer("abcde"); (3)if(s.equals(s1)) (4)s1=null; (5)if(sequals(s)) (6)s=null:A.第(1)行编译错误,String 的构造器必须明确调用B.第(3)行编译错误,因为s与s1有不同的类型C.编译成功,但执行时在第(5)行有异常抛出D.编译成功,执行过程中也没有异常抛出

考题 对下列程序的叙述中,正确的是( )。 1:public class X extends Thread implements Runnable{ 2:public void run{ 3:system.out.println("this is run"); 4:} 5:oublic static void main(String args[]){ 6:Thread t=new Thread(new X): 7:t.start; 8:} 9:}A.第l行会产生编译错误B.第6行会产生编译错程C.第6行会产生运行错误D.程序正常运行

考题 关于以下代码段的说法正确的是( )。 (1) String s="abcde"; (2) String Buffer s1=new String Buffer("abcde"); (3) if(s.equals(s1)) (4) s1=null: (5) if(s1.equals(s)) (6) s=null;A.第(1)行编译错误,String的构造器必须明确调用B.第(3)行编译错误,因为s与s1有不同的类型C.编译成功,但执行时在第(5)行有异常抛出D.编译成功,执行过程中也没有异常抛出

考题 A派生出子类B ,B派生出子类C,并且在Java源代码中有如下声明: A a0=new A(); A a1 =new B(); A a2=new C(); 问以下哪个说法是正确的? } A.只有第1行能通过编译B.第1、2行能通过编译,但第3行编译出错C.第1、2、3行能通过编译,但第2、3行运行时出错D.第1行、第2行和第3行的声明都是正确的

考题 类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,3C.程序通过编译,输出结果为3,5D.程序通过编译,输出结果为:5,5

考题 以下的程序的执行结果为? () 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());  }  } A、输出171.0B、输出171C、第2行和第5行编译报错D、第10行编译报错

考题 在Java中,下列代码将输出()。  1.    public class integerequals  2.    {  3.       public static void main (String args[])  4. {  5.  Integer a= new Integer(3);  6.  Integer b= new Integer(3);  7.   System.out.println(a==b);  8. }  9.    } A、编译器将显示第7行有错误B、程序编译并打印trueC、程序编译并打印falseD、程序编译但在第7行引起了一个运行期意外

考题 现有:  interface  I  {  void go();  }      abstract class A implements I { }      class C extends A  {     void go(){ }     }  结果是什么?()   A、代码通过编译B、由于第1行的错误导致编译失败C、由于笫3行的错误导致编译失败D、由于第6行的错误导致编译失败

考题 现有:  1.  class Propeller2  {  2.   pulolic static void main (String[]args)//add code here?      3.    {  new Propeller2().topGo();  }      4.  5.void topGo()  //add code here?      6.    {   middleGo();  }      7.  8.void middleGo()  //add code here?  9. {   go();  System.out.println ("late middle");  }    void go()  //add code here?      12.    {throw new Exception();  }      13.  }  为使代码通过编译,需要在哪一行加入声明throws Exception?()     A、只在第11行B、在第8行和第11行C、在第5行、第8行和第11行D、在第2行、第5行、第8行和第11行

考题 A派生出子类B,B派生出子类C,并且在Java源代码中有如下声明:1.A  a0=new  A(); 2.A  a1=new B(); 3.A  a2=new C();问以下哪个说法是正确的?()A、只有第1行能通过编译B、第1、2行能通过编译,但第3行编译出错C、第1、2、3行能通过编译,但第2、3行运行时出错D、第1行、第2行和第3行的声明都是正确的

考题 编译并运行以下程序,以下描述哪个选项是正确的() class  A  { protected  boolean  equals()  {    return  super.equals(); }   }A、编译通过运行无异常B、编译通过但运行时出错C、行2出错,不能成功编译D、不能成功编译,行3出错

考题 关于以下程序段的说法正确的是()。 1.publicclassMyar{ 2.publicstaticvoidmain(Stringargv[]){ 3.int[]i=newint[5] 4.System.out.println(i[5]) 5.}A、第2行编译出错B、第4行编译出错C、编译时产生错误D、编译时没有产生错误,运行时发生异常

考题 A派生出子类B,B派生出子类C,并且在Java源代码中有如下声明:1.Aa0=newA();2.Aa1=newB();3.Aa2=newC();问以下哪个说法是正确的?()A、只有第1行能通过编译B、第1、2行能通过编译,但第3行编译出错C、第1、2、3行能通过编译,但第2、3行运行时出错D、第1行、第2行和第3行的声明都是正确的

考题 1. interface I { void go(); }   2.   3. abstract class A implements I { }  4.   5. class C extends A {   6. void go(){ }   7. }   结果是什么?()  A、代码通过编译B、由于多个错误导致编译失败C、由于第1行的错误导致编译失败D、由于第6行的错误导致编译失败

考题 单选题关于以下程序段的说法正确的是()。 1.publicclassMyar{ 2.publicstaticvoidmain(Stringargv[]){ 3.int[]i=newint[5] 4.System.out.println(i[5]) 5.}A 第2行编译出错B 第4行编译出错C 编译时产生错误D 编译时没有产生错误,运行时发生异常

考题 单选题1. interface I { void go(); }   2.   3. abstract class A implements I { }  4.   5. class C extends A {   6. void go(){ }   7. }   结果是什么?()A 代码通过编译B 由于多个错误导致编译失败C 由于第1行的错误导致编译失败D 由于第6行的错误导致编译失败

考题 单选题以下的程序的执行结果为? () 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());  }  }A 输出171.0B 输出171C 第2行和第5行编译报错D 第10行编译报错

考题 单选题A派生出子类B,B派生出子类C,并且在Java源代码中有如下声明:1.Aa0=newA();2.Aa1=newB();3.Aa2=newC();问以下哪个说法是正确的?()A 只有第1行能通过编译B 第1、2行能通过编译,但第3行编译出错C 第1、2、3行能通过编译,但第2、3行运行时出错D 第1行、第2行和第3行的声明都是正确的

考题 单选题现有:  1.  class Propeller2  {  2.   pulolic static void main (String[]args)//add code here?      3.    {  new Propeller2().topGo();  }      4.  5.void topGo()  //add code here?      6.    {   middleGo();  }      7.  8.void middleGo()  //add code here?  9. {   go();  System.out.println ("late middle");  }    void go()  //add code here?      12.    {throw new Exception();  }      13.  }  为使代码通过编译,需要在哪一行加入声明throws Exception?()A 只在第11行B 在第8行和第11行C 在第5行、第8行和第11行D 在第2行、第5行、第8行和第11行

考题 单选题在Java中,下列代码将输出()。  1.    public class integerequals  2.    {  3.       public static void main (String args[])  4. {  5.  Integer a= new Integer(3);  6.  Integer b= new Integer(3);  7.   System.out.println(a==b);  8. }  9.    }A 编译器将显示第7行有错误B 程序编译并打印trueC 程序编译并打印falseD 程序编译但在第7行引起了一个运行期意外

考题 单选题编译并运行以下程序,以下描述哪个选项是正确的() class  A  { protected  boolean  equals()  {    return  super.equals(); }   }A 编译通过运行无异常B 编译通过但运行时出错C 行2出错,不能成功编译D 不能成功编译,行3出错