现有: 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、 cat5 cableD、 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 [] args) { SubCat s= new SubCat(); } } 结果为:()
- A、 cat5
- B、 cable
- C、 cat5 cable
- D、 cable cat5
相关考题:
现有:classCat{Cat(intc){System.out.print(cat+c+);}}classSubCatextendsCat{SubCat(intc){super(5);System.out.print(cable);}SubCat(){this(4);}publicstaticvoidmain(String[]args){SubCats=newSubCat();}}结果为:()A.cat5B.cableC.cablecat5D.cat5cable
现有:classCat{Cat(intc){System.out.print{cat+c+);}}classSubCatextendsCat{SubCat(intc){super(5);System.out.print(cable);}SubCat(){this(4);}publicstaticvoidmain(String[]args){SubCats=newSubCat();}}结果为:()A.cat5B.cableC.cat5cableD.cablecat5
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 Base{Base(){int i = 100;System.out.print (i);}}public class Pri extends Base{static int i = 200;public static void main(String argv[]){Pri p = new Pri();System.out.print(i);}} A.编译错误B.200C.100200D.100
现有: 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、 42B、 ExcC、 42ExcD、编译失败
现有: 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、 42B、 编译失败。C、 无输出结果。D、 运行时异常被抛出。
class super { public int getLength() {return 4;} } public class Sub extends Super { public long getLength() {return 5;} public static void main (String[]args) { super sooper = new Super (); Sub sub = new Sub(); System.out.printIn( sooper.getLength()+ “,” + sub.getLength() }; } What is the output?() A、 4, 4B、 4, 5C、 5, 4D、 5, 5E、 The code will not compile.
现有 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、 42ExcB、 ExcC、 42D、编译失败
class Flibitz { public static void main(String [] args) { int grop = 7; new Flibitz().go(grop); System.out.print(grop); } void go(int grop) { if(++grop 〉 7) grop++; System.out.print(grop); } } 结果为:() A、77B、79C、97D、99
现有: 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、 42B、 编译失败。C、 无输出结果。D、 运行时异常被抛出。
class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
class Super { public int getLenght() { return 4; } } public class Sub extends Super { public long getLenght() { return 5; } public static void main(String[] args) {Super sooper = new Super(); Sub sub = new Sub(); System.out.println( sooper.getLenght() + “,” + sub.getLenght() ); } } What is the output? ()A、 4,4B、 4,5C、 5,4D、 5,5E、 Compilation fails.
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、 peepB、 barkC、 meowD、 Compilation fails.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 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 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 beverageB、beer2 beverageC、beverage beer1D、编译失败
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 PetB、Cat Cat CatC、Cat Dog PetD、Cat Dog Dog
现有 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 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、42B、编译失败C、无输出结果D、运行时异常被抛出
现有: class Output { public static void main (String[] args) { int i=5: System.out.print( "4"+i+""); System.out.print (i+5+"7"); System.out.println (i+"8"); } } 结果为:() A、 99722B、 955758C、 4510758D、 459722
单选题现有: 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 42B ExcC 42ExcD编译失败
单选题现有: 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 cat5 cableD 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 [] args) { SubCat s = new SubCat(); } } 结果为:()Acat5BcableCcable cat5Dcat5 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); } } 结果是什么?()A55B56C65D66
单选题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 "); } } 结果是什么?()Abeer1 beverageBbeer2 beverageCbeverage beer1D编译失败
单选题现有: class Output { public static void main (String[] args) { int i=5: System.out.print( "4"+i+""); System.out.print (i+5+"7"); System.out.println (i+"8"); } } 结果为:()A 99722B 955758C 4510758D 459722
单选题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(); 后输出的内容是哪项?()APet Pet PetBCat Cat CatCCat Dog PetDCat Dog Dog