niusouti.com

单选题现有:      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  []  arg

题目
单选题
现有:      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

 cat5

B

 cable

C

 cat5 cable

D

 cable cat5


相似考题
更多“单选题现有:      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  []  arg”相关问题
  • 第1题:

    10. interface Jumper { public void jump(); }  ......  20. class Animal {}  ......  30. class Dog extends Animal { 31. Tail tail; 32. }  ......  40. class Beagle extends Dog implements Jumper {  41. public void jump() { }  42. }  .......  50. class Cat implements Jumper {  51. public void jump() { }  52. }  Which three are true?()

    • A、 Cat is-a Animal
    • B、 Cat is-a Jumper
    • C、 Dog is-a Animal
    • D、 Dog is-a Jumper
    • E、 Cat has-a Animal
    • F、 Beagle has-a Tail
    • G、 Beagle has-a Jumper

    正确答案:B,F

  • 第2题:

    现有  class Parser extends Utils {  public static void main (String  []  args)  {  try  {  System.out.print (new Parser () .getlnt ("42"))       }  catch (Exception e) {  System.out.println ("Exc") ;  }      }  int getlnt (String arg)  throws Exception  {     return Integer.parselnt (arg) ;      }      }  class Utils {  int getlnt ()  {  return 42;  }     }  结果是什么?()      

    • A、 42Exc
    • B、 Exc
    • C、 42
    • D、编译失败

    正确答案:C

  • 第3题:

    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?() 

    • A、 peep
    • B、 bark
    • C、 meow
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:E

  • 第4题:

    class Parser extends Utils {  public static void main (String [] args) {  try { System.out.print(new Parser().getInt("42"));  } catch (NumberFormatException n) {  System.out.println("NFExc "); }  }  int getInt(String arg) throws NumberFormatException {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) { return 42; }  }  结果为:() 

    • A、42
    • B、NFExc
    • C、42NFExc
    • D、编译失败

    正确答案:A

  • 第5题:

    public class Pet{  public void speak(){   System.out.print(“ Pet ”);  }  }   public class Cat extends Pet{  public void speak(){   System.out.print(“ Cat ”);  }  }   public class Dog extends Pet{  public void speak(){   System.out.print(“ Dog ”);  }  }   执行代码   Pet[] p = {new Cat(),new Dog(),new Pet()};   for(int i=0;i〈p.length;i++)   p[i].speak();   后输出的内容是哪项?()  

    • A、Pet Pet Pet
    • B、Cat Cat Cat
    • C、Cat Dog Pet
    • D、Cat Dog Dog

    正确答案:C

  • 第6题:

    现有  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 beverage
    • B、beer2 beverage
    • C、beverage beer2 beerl
    • D、编译失败

    正确答案:D

  • 第7题:

    单选题
    现有:   class Parser extends Utils {   public static void main(String [] args) {     System.out.print(new Parser().getInt("42"));    }   int getInt(String arg) {  return Integer.parseInt(arg);  }    }   class Utils {     int getInt(String arg) throws Exception { return 42; }    }    结果为()
    A

     42

    B

     编译失败。

    C

     无输出结果。

    D

     运行时异常被抛出。


    正确答案: D
    解析: 暂无解析

  • 第8题:

    单选题
    现有  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 beverage

    B

    beer2 beverage

    C

    beverage beer2 beerl

    D

    编译失败


    正确答案: C
    解析: 暂无解析

  • 第9题:

    单选题
    现有:  class Parser (类)extends(继承) Utils {   public static void main(String [] args) {   System.out.print(输出打印)(new Parser().getInt("42"));  }   int getInt(String arg) {   return Integer.parseInt(arg);    }   }   class Utils {   int getInt(String arg) throws Exception { return 42; }  }   结果为:()
    A

     42

    B

     编译失败。

    C

     无输出结果。

    D

     运行时异常被抛出。


    正确答案: A
    解析: 暂无解析

  • 第10题:

    单选题
    class Parser extends Utils {  public static void main (String [] args) {  try { System.out.print(new Parser().getInt("42"));  } catch (NumberFormatException n) {  System.out.println("NFExc "); }  }  int getInt(String arg) throws NumberFormatException {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) { return 42; }  }  结果为:()
    A

    42

    B

    NFExc

    C

    42NFExc

    D

    编译失败


    正确答案: D
    解析: 暂无解析

  • 第11题:

    单选题
    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("beer1 ");   }   public Beer() { System.out.print("beer2 "); }  }   结果是什么?()
    A

    beer1 beverage

    B

    beer2 beverage

    C

    beverage beer1

    D

    编译失败


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    public class Pet{  public void speak(){   System.out.print(“ Pet ”);  }  }   public class Cat extends Pet{  public void speak(){   System.out.print(“ Cat ”);  }  }   public class Dog extends Pet{  public void speak(){   System.out.print(“ Dog ”);  }  }   执行代码   Pet[] p = {new Cat(),new Dog(),new Pet()};   for(int i=0;i〈p.length;i++)   p[i].speak();   后输出的内容是哪项?()
    A

    Pet Pet Pet

    B

    Cat Cat Cat

    C

    Cat Dog Pet

    D

    Cat Dog Dog


    正确答案: D
    解析: 暂无解析

  • 第13题:

    现有:  class Parser (类)extends(继承) Utils {   public static void main(String [] args) {   System.out.print(输出打印)(new Parser().getInt("42"));  }   int getInt(String arg) {   return Integer.parseInt(arg);    }   }   class Utils {   int getInt(String arg) throws Exception { return 42; }  }   结果为:()  

    • A、 42
    • B、 编译失败。
    • C、 无输出结果。
    • D、 运行时异常被抛出。

    正确答案:A

  • 第14题:

    现有:   class Parser extends Utils {   public static void main(String [] args) {     System.out.print(new Parser().getInt("42"));    }   int getInt(String arg) {  return Integer.parseInt(arg);  }    }   class Utils {     int getInt(String arg) throws Exception { return 42; }    }    结果为()  

    • A、 42
    • B、 编译失败。
    • C、 无输出结果。
    • D、 运行时异常被抛出。

    正确答案:A

  • 第15题:

    现有:  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、cat5
    • B、cable
    • C、cable cat5
    • D、cat5 cable

    正确答案:D

  • 第16题:

    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("beer1 ");   }   public Beer() { System.out.print("beer2 "); }  }   结果是什么?()  

    • A、beer1 beverage
    • B、beer2 beverage
    • C、beverage beer1
    • D、编译失败

    正确答案:D

  • 第17题:

    现有:      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、 cat5
    • B、 cable
    • C、 cat5 cable
    • D、 cable cat5

    正确答案:C

  • 第18题:

    class Parser extends Utils {  public static void main(String [] args) {   System.out.print(new Parser().getInt("42"));  }  int getInt(String arg) {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) throws Exception { return 42; }  }  结果为:() 

    • A、42
    • B、编译失败
    • C、无输出结果
    • D、运行时异常被抛出

    正确答案:A

  • 第19题:

    单选题
    现有:  class Parser extends Utils  { public static void main (String[]  args)    {     try{System.out.print (new Parser().getlnt("42"));      } catch (Exception e)    {      System.out.println("Exc");  }      }  int getlnt (String arg) throws Exception  {      return Integer.parselnt (arg);      }       class Utils  {  int getlnt (String arg)    {return 42;  }      }      结果为()
    A

     42

    B

     Exc

    C

     42Exc

    D

    编译失败


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    class Parser extends Utils {  public static void main(String [] args) {   System.out.print(new Parser().getInt("42"));  }  int getInt(String arg) {  return Integer.parseInt(arg);  }  }  class Utils {  int getInt(String arg) throws Exception { return 42; }  }  结果为:()
    A

    42

    B

    编译失败

    C

    无输出结果

    D

    运行时异常被抛出


    正确答案: A
    解析: 暂无解析

  • 第21题:

    单选题
    现有:  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

    cat5

    B

    cable

    C

    cable cat5

    D

    cat5 cable


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?()
    A

     peep

    B

     bark

    C

     meow

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


    正确答案: E
    解析: 暂无解析

  • 第23题:

    单选题
    现有  class Parser extends Utils {  public static void main (String  []  args)  {  try  {  System.out.print (new Parser () .getlnt ("42"))       }  catch (Exception e) {  System.out.println ("Exc") ;  }      }  int getlnt (String arg)  throws Exception  {     return Integer.parselnt (arg) ;      }      }  class Utils {  int getlnt ()  {  return 42;  }     }  结果是什么?()
    A

     42Exc

    B

     Exc

    C

     42

    D

    编译失败


    正确答案: B
    解析: 暂无解析