多选题现有: class HorseRadish { //insert code here protected HorseRadish (int x) { System.out.println ("bok choy"); } } class Wasabi extends HorseRadish { public static void main (String [] args){ Wasabi w- new Wasabi(); } } 分别插入到第2行,哪两项允许代码编译并产生”bok choy”输出结果()Aprotected HorseRadish() {this (42);}Bprotected HorseRadish() {}C//just a commentDprotected HorseRadish() { new HorseRadish (42);}
多选题
现有: class HorseRadish { //insert code here protected HorseRadish (int x) { System.out.println ("bok choy"); } } class Wasabi extends HorseRadish { public static void main (String [] args){ Wasabi w- new Wasabi(); } } 分别插入到第2行,哪两项允许代码编译并产生”bok choy”输出结果()
A
protected HorseRadish() {this (42);}
B
protected HorseRadish() {}
C
//just a comment
D
protected HorseRadish() { new HorseRadish (42);}
参考解析
解析:
暂无解析
相关考题:
Given:Which three methods, inserted individually at line 14, will correctly complete class Two?() A.int foo() { /* more code here */ }B.void foo() { /* more code here */ }C.public void foo() { /* more code here */ }D.private void foo() { /* more code here */ }E.protected void foo() { /* more code here */ }
1. class BaseClass { 2. private float x = 1.of; 3. protected float getVar() { return x; } 4. } 5. class SubClass extends BaseClass { 6. private float x = 2.Of; 7. // insert code here 8. } Which two are valid examples of method overriding when inserted at line 7?() A、 float getVar() { return x; }B、 public float getVar() { return x; }C、 public double getVar() { return x; }D、 protected float getVar() { return x; }E、 public float getVar(float f) { return f; }
现有包结构: com |-- x | |-- Alpha.class | | | |-- y | |-- Beta.class | |-- Gamma.class 和类: //insert code here import com.*; import com.x.y.*; class Test { Alpha a; Beta b; Gamma c; } 哪两行分别插入后可允许代码编译?() A、package com.;B、import com.x;C、package com.x;D、import com.x.Alpha;
Which lines of code are valid declarations of a native method when occurring within the declaration of the following class?() public class Qf575 { // insert declaration of a native method here } A、native public void setTemperature(int kelvin);B、private native void setTemperature(int kelvin);C、protected int native getTemperature();D、public abstract native void setTemperature(int kelvin);E、native int setTemperature(int kelvin) {}
class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 int foo() { /* more code here */ }B、 void foo() { /* more code here */ }C、 public void foo() { /* more code here */ }D、 private void foo() { /* more code here */ }E、 protected void foo() { /* more code here */ }
现有: 1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?() A、 // just a commentB、 protected HorseRadish() { }C、 protected HorseRadish() { this(42);}D、 protected HorseRadish() { new HorseRadish (42);}
1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?() A、 // just a commentB、 protected HorseRadish() { }C、 protected HorseRadish() { this(42);}D、 protected HorseRadish() { new HorseRadish (42);}
现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?() A、 0B、 1C、 2D、 3
现有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()A、 int gap() { return 7; }B、 public int gap() { return 7; }C、 private int gap(int x) { return 7; }D、 protected Creb gap() { return this; }E、 public int gap() { return Integer.getInteger ("42"); }
public class OuterClass { private double d1 1.0; //insert code here } You need to insert an inner class declaration at line2. Which two inner class declarations are valid?() A、 static class InnerOne { public double methoda() {return d1;} }B、 static class InnerOne { static double methoda() {return d1;} }C、 private class InnerOne { public double methoda() {return d1;} }D、 protected class InnerOne { static double methoda() {return d1;} }E、 public abstract class InnerOne { public abstract double methoda(); }
1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()A、 int gap() { return 7; }B、 public int gap() { return 7; }C、 private int gap(int x) { return 7; }D、 protected Creb gap() { return this; }E、 public int gap() { return Integer.getInteger ("42"); }
现有: class HorseRadish { //insert code here protected HorseRadish (int x) { System.out.println ("bok choy"); } } class Wasabi extends HorseRadish { public static void main (String [] args){ Wasabi w- new Wasabi(); } } 分别插入到第2行,哪两项允许代码编译并产生”bok choy”输出结果()A、 protected HorseRadish() {this (42);}B、 protected HorseRadish() {}C、 //just a commentD、 protected HorseRadish() { new HorseRadish (42);}
1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3?() A、 static class InnerOne { public double methoda() { return d1; } }B、 static class InnerOne { static double methoda() { return d1; } }C、 private class InnerOne { public double methoda() { return d1; } }D、 protected class InnerOne { static double methoda() { return d1; } }E、 public abstract class InnerOne { public abstract double methoda(); }
11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()A、 finalB、 staticC、 nativeD、 publicE、 privateF、 abstractG、 protected
1. public class Blip { 2. protected int blipvert(int x) { return 0; } 3. } 4. class Vert extends Blip { 5. // insert code here 6. } Which five methods, inserted independently at line 5, will compile?() A、 public int blipvert(int x) { return 0; }B、 private int blipvert(int x) { return 0; }C、 private int blipvert(long x) { return 0; }D、 protected long blipvert(int x, int y) { return 0; }E、 protected int blipvert(long x) { return 0; }F、 protected long blipvert(long x) { return 0; }G、protected long blipvert(int x) { return 0; }
Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 public void foo() { /* more code here */ }B、 private void foo() { /* more code here */ }C、 protected void foo() { /* more code here */ }D、 int foo() { /* more code here */ } E、 void foo() { /* more code here */ }
多选题Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }
多选题class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }
单选题现有: 1. abstract class Color { 2.protected abstract String getRGB(); 3. } 4. 5. public class Blue extends Color { 6. //insert code here 7. } 和四个声明: public String getRGB() { return "blue"; } String getRGB() { return "blue"; ) private String getRGB() { return "blue"; } protected String getRGB() { return "blue"; ) 分别插入到第6行,有几个可以通过编译?()A 0B 1C 2D 3
多选题现有: class HorseRadish { //insert code here protected HorseRadish (int x) { System.out.println ("bok choy"); } } class Wasabi extends HorseRadish { public static void main (String [] args){ Wasabi w- new Wasabi(); } } 分别插入到第2行,哪两项允许代码编译并产生”bok choy”输出结果()Aprotected HorseRadish() {this (42);}Bprotected HorseRadish() {}C//just a commentDprotected HorseRadish() { new HorseRadish (42);}
多选题现有: 1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?()A// just a commentBprotected HorseRadish() { }Cprotected HorseRadish() { this(42);}Dprotected HorseRadish() { new HorseRadish (42);}
多选题1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }
单选题现有: 1.class Over { 2.int dolt (long x) { return 3; } 3. } 4. 5. class Under extends Over { 6.//insert code here 7. } 和四个方法: short dolt (int y) { return 4; } int dolt(long Xr long y) { return 4; } private int dolt(short y) { return 4; } protected int dolt (long x) { return 4; } 分别插入到第6行,有几个可以通过编译?()A 1B 2C 3D 4
单选题public class Score implements Comparable { private int wins, losses; public Score(int w, int 1) { wins = w; losses = 1; } public int getWins() { return wins; } public int getLosses() { return losses; } public String toString() { return “”; } // insert code here } Which method will complete this class?()A public int compareTo(Object o) {/*mode code here*/}B public int compareTo(Score other) {/*more code here*/}C public int compare(Score s1,Score s2){/*more code here*/}D public int compare(Object o1,Object o2){/*more code here*/}
单选题现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?()A 0B 1C 2D 3
多选题1. class HorseRadish { 2. // insert code here 3. protected HorseRadish(int x) { 4. System.out.println("bok choy"); 5. } 6. } 7. class Wasabi extends HorseRadish { 8. public static void main(String [] args) { 9. Wasabi w = new Wasabi(); 10. } 11. } 分别插入到第 2 行,哪两项允许代码编译并产生"bok choy" 输出结果?()A// just a commentBprotected HorseRadish() { }Cprotected HorseRadish() { this(42);}Dprotected HorseRadish() { new HorseRadish (42);}
单选题现有: interface Animal { void eat () ; } //insert code here public class HouseCat extends Feline { public void eat() { } } 和五个申明 abstract class Feline implements Animal { } abstract class Feline implements Animal { void eat () ; } abstract class Feline implements Animal { public void eat();} abstract class Feline implements Animal { public void eat() {} } abstract class Feline implements Animal { abstract public void eat();} 结果为:()A1B2C3D4
多选题现有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }