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

题目内容 (请给出正确答案)
单选题
现有:  class Bird {  void talk() { System.out.print("chirp "); }         }  class Parrot2 extends Bird {  protected void talk() { System.out.print("hello ");        public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot2 () };         for( Bird b : birds)          b.talk () ;         }         }  结果是什么 ?()
A

 chirp chirp

B

 hello hello

C

 chirp hello

D

编译错误


参考答案

参考解析
解析: 暂无解析
更多 “单选题现有:  class Bird {  void talk() { System.out.print("chirp "); }         }  class Parrot2 extends Bird {  protected void talk() { System.out.print("hello ");        public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot2 () };         for( Bird b : birds)          b.talk () ;         }         }  结果是什么 ?()A  chirp chirpB  hello helloC  chirp helloD 编译错误” 相关考题
考题 classBird{staticvoidtalk(){System.out.print(chirp);}}classParrotextendsBird{staticvoidtalk(){System.out.print(hello);}publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot()};for(Birdb:birds)b.talk();}}结果为:()A.chirpchirpB.chirphelloC.hellohelloD.编译失败

考题 现有:classBird{voidtalk(){System.out.print(chirp);}}classParrot2extendsBird{protectedvoidtalk(){System.out.print(hello);publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot2()};for(Birdb:birds)b.talk();}}结果是什么?()A.chirpchirpB.hellohelloC.chirphelloD.编译错误

考题 interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}

考题 class One {  public One() { System.out.print(1); }  }  class Two extends One {  public Two() { System.out.print(2); }  }  class Three extends Two {  public Three() { System.out.print(3); }  }  public class Numbers{  public static void main( String[] argv) { new Three(); }  }  What is the result when this code is executed?() A、 1B、 3C、 123D、 321E、 The code rims with no output.

考题 class BitStuff {   BitStuff go() { System.out.print("bits "); return this; }   }   class MoreBits extends BitStuff {   MoreBits go() { System.out.print("more "); return this; }   public static void main(String [] args) {   BitStuff [] bs = {new BitStuff(), new MoreBits()};   for( BitStuff b : bs)   b.go();   }   }   结果为:()  A、bits bitsB、bits moreC、more moreD、编译失败

考题 public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?() A、 foofoofoofoofooB、 foobarfoobarbarC、 foobarfoofoofooD、 foobarfoobarfooE、 barbarbarbarbarF、 foofoofoobarbarG、 foofoofoobarfoo

考题 现有:  class Bird {  void talk() { System.out.print("chirp "); }         }  class Parrot2 extends Bird {  protected void talk() { System.out.print("hello ");        public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot2 () };         for( Bird b : birds)          b.talk () ;         }         }  结果是什么 ?()      A、 chirp chirpB、 hello helloC、 chirp helloD、编译错误

考题 class Bird {  static void talk() { System.out.print("chirp "); }  }  class Parrot extends Bird {  static void talk() { System.out.print("hello "); }  public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot()};  for( Bird b : birds)  b.talk();  }  }  结果为:() A、chirp chirpB、chirp helloC、hello helloD、编译失败

考题 现有:  class Cat {  Cat(int c) { System.out.print("cat" + c + " "); }  }  class SubCat extends Cat {  SubCat(int c) { super(5); System.out.print("cable "); }  SubCat() { this(4); }  public static void main(String [] args) {  SubCat s = new SubCat();  }  } 结果为:() A、cat5B、cableC、cable cat5D、cat5 cable

考题 class Passer {  static final int x = 5;  public static void main(String [] args) { new Passer().go(x);  System.out.print(x);  }  void go(int x) {  System.out.print(++x);  }  }  结果是什么?() A、55B、56C、65D、66

考题 public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()  A、 BDB、 BCDC、 BDED、 BCDEE、 ABCDEF、 Compilation fails.

考题 public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? () A、 ABB、 BCC、 ABCD、 BCDE、 Compilation fails.

考题 现有  class Beverage {  Beverage ()  {  System.out.print ("beverage ");  }        }  class Beer extends Beverage {  public static void main{string [] args) {        Beer b = new Beer (14) ;       }  public int Beer(int x) {       this () ;  System.out.print ("beerl") ;      }  public Beer() { System.out.print("beer2 "); }     }  结果是什么?() A、beerl beverageB、beer2 beverageC、beverage beer2 beerlD、编译失败

考题 现有:  class Birds {  public static void main (String  []  args)  {   try {  throw new Exception () ;    } catch (Exception e) {   try {   throw new Exception () ;  }  catch  (Exception e2)  {  System.out.print ("inner           "); }   System. out.print ( "middle" ) ;    }  System.out.print ("outer") ;    }    }  结果是()A、 inner outerB、 middle outerC、 inner middle outerD、.编译失败

考题 class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()  A、innerB、inner outerC、middle outerD、inner middle outer

考题 class Base {  Base() { System.out.print(“Base”); }  }  public class Alpha extends Base {  public static void main( String[] args ) {  new Alpha();  new Base();  }  }  What is the result?()  A、 BaseB、 BaseBaseC、 Compilation fails.D、 The code runs with no output.E、 An exception is thrown at runtime.

考题 单选题现有  class Beverage {  Beverage ()  {  System.out.print ("beverage ");  }        }  class Beer extends Beverage {  public static void main{string [] args) {        Beer b = new Beer (14) ;       }  public int Beer(int x) {       this () ;  System.out.print ("beerl") ;      }  public Beer() { System.out.print("beer2 "); }     }  结果是什么?()A beerl beverageB beer2 beverageC beverage beer2 beerlD 编译失败

考题 单选题现有:  class Birds {  public static void main (String  []  args)  {   try {  throw new Exception () ;    } catch (Exception e) {   try {   throw new Exception () ;  }  catch  (Exception e2)  {  System.out.print ("inner           "); }   System. out.print ( "middle" ) ;    }  System.out.print ("outer") ;    }    }  结果是()A  inner outerB  middle outerC  inner middle outerD .编译失败

考题 单选题class Base {  Base() { System.out.print(“Base”); }  }  public class Alpha extends Base {  public static void main( String[] args ) {  new Alpha();  new Base();  }  }  What is the result?()A  BaseB  BaseBaseC  Compilation fails.D  The code runs with no output.E  An exception is thrown at runtime.

考题 单选题现有:  class Cat {  Cat(int c) { System.out.print("cat" + c + " "); }  }  class SubCat extends Cat {  SubCat(int c) { super(5); System.out.print("cable "); }  SubCat() { this(4); }  public static void main(String [] args) {  SubCat s = new SubCat();  }  } 结果为:()A cat5B cableC cable cat5D cat5 cable

考题 单选题class Bird {  static void talk() { System.out.print("chirp "); }  }  class Parrot extends Bird {  static void talk() { System.out.print("hello "); }  public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot()};  for( Bird b : birds)  b.talk();  }  }  结果为:()A chirp chirpB chirp helloC hello helloD 编译失败

考题 单选题public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? ()A  ABB  BCC  ABCD  BCDE  Compilation fails.

考题 单选题下列程序的运行结果是(  )。class Shape{ public Shape(){ System.out.print("Shape"); }}class Circle extends Shape{ public Circle(){ System.out.print("Circle"); }}public class Test{ public static void main(String[]args){ Shape d=new Circle(); }}A ShapeB CircleC ShapeCircleD 程序有错误

考题 单选题class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()A innerB inner outerC middle outerD inner middle outer

考题 单选题class Passer {  static final int x = 5;  public static void main(String [] args) { new Passer().go(x);  System.out.print(x);  }  void go(int x) {  System.out.print(++x);  }  }  结果是什么?()A 55B 56C 65D 66

考题 单选题class BitStuff {   BitStuff go() { System.out.print("bits "); return this; }   }   class MoreBits extends BitStuff {   MoreBits go() { System.out.print("more "); return this; }   public static void main(String [] args) {   BitStuff [] bs = {new BitStuff(), new MoreBits()};   for( BitStuff b : bs)   b.go();   }   }   结果为:()A bits bitsB bits moreC more moreD 编译失败

考题 单选题public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?()A  foofoofoofoofooB  foobarfoobarbarC  foobarfoofoofooD  foobarfoobarfooE  barbarbarbarbarF  foofoofoobarbarG  foofoofoobarfoo