网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
多选题
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(); }
参考答案
参考解析
解析:
暂无解析
更多 “多选题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?()Astatic class InnerOne { public double methoda() {return d1;} }Bstatic class InnerOne { static double methoda() {return d1;} }Cprivate class InnerOne { public double methoda() {return d1;} }Dprotected class InnerOne { static double methoda() {return d1;} }Epublic abstract class InnerOne { public abstract double methoda(); }” 相关考题
考题
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; }
考题
Which two statements are true?()A、 An inner class may be declared as static.B、 An anonymous inner class can be declared as public.C、 An anonymous inner class can be declared as private.D、 An anonymous inner class can extend an abstract class.E、 An anonymous inner class can be declared as protected.
考题
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 */ }
考题
Which two are valid declarations within an interface definition?() A、 void methoda();B、 public double methoda();C、 public final double methoda();D、 static void methoda(double d1);E、 protected void methoda(double d1);
考题
Given the following code, which method declarations, when inserted at the indicated position, will not cause the program to fail compilation?() public class Qdd1f { public long sum(long a, long b) { return a + b; } // insert new method declaration here } A、public int sum(int a, int b) { return a + b; }B、public int sum(long a, long b) { return 0; }C、abstract int sum();D、private long sum(long a, long b) { return a + b; }E、public long sum(long a, int b) { return a + b; }
考题
10. abstract public class Employee { 11. protected abstract double getSalesAmount(); 12. public double getCommision() { 13. return getSalesAmount() * 0.15; 14. } 15. } 16. class Sales extends Employee { 17. // insert method here 18. } Which two methods, inserted independently at line 17, correctly complete the Sales class?()A、 double getSalesAmount() { return 1230.45; }B、 public double getSalesAmount() { return 1230.45; }C、 private double getSalesAmount() { return 1230.45; }D、 protected double getSalesAmount() { return 1230.45; }
考题
package foo; public class Outer ( public static class Inner ( ) ) Which statement is true? () A、 An instance of the Inner class can be constructed with “new Outer.Inner ()”B、 An instance of the inner class cannot be constructed outside of package foo.C、 An instance of the inner class can only be constructed from within the outer class.D、 From within the package bar, an instance of the inner class can be constructed with “new inner()”
考题
Which the following two statements are true?()A、 An inner class may be declared as static.B、 An anonymous inner class can be declared as public.C、 An anonymous inner class can be declared as private.D、 An anonymous inner class can extend an abstract class.E、 An anonymous inner class can be declared as protected.
考题
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(); }
考题
class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass extends BaseClass { private float x = 2.0f; //insert code here } Which two are valid examples of method overriding?() A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }
考题
class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()A、 public void foo() { }B、 public int foo() { return 3; }C、 public Two foo() { return this; }D、 public One foo() { return this; }E、 public Object foo() { return this; }
考题
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 ““ + wins + “,“ + losses + “”; } // 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*/}
考题
public class enclosingone ( public class insideone{} ) public class inertest( public static void main (stringargs)( enclosingone eo= new enclosingone (); //insert code here ) ) Which statement at line 7 constructs an instance of the inner class?()A、 InsideOnew ei= eo.new InsideOn();B、 Eo.InsideOne ei = eo.new InsideOne();C、 InsideOne ei = EnclosingOne.new InsideOne();D、 EnclosingOne.InsideOne ei = eo.new InsideOne();
考题
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(); }
考题
Which will declare a method that is available to all members of the same package and can be referenced without an instance of the class?() A、 Abstract public void methoda();B、 Public abstract double methoda();C、 Static void methoda(double d1){}D、 Public native double methoda() {}E、 Protected void methoda(double d1) {}
考题
public class returnIt ( returnType methodA(byte x, double y) ( return (short) x/y * 2; ) ) What is the valid returnType for methodA in line 2?()A、 IntB、 ByteC、 LongD、 ShortE、 FloatF、 Double
考题
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 */ }
考题
多选题10. class Inner { 11. private int x; 12. public void setX( int x) { this.x = x; } 13. public int getX() { return x; } 14. } 15. 16. class Outer { 17. private Inner y; 18. public void setY( Inner y) { this.y = y; } 19. public Inner getY() { return y; } 20. } 21. 22. public class Gamma { 23. public static void main( String[] args) { 24. Outer o = new Outer(); 25. Inner i = new Inner(); 26.int n=10; 27. i.setX(n); 28. o.setY(i); 29. // insert code here 30. System.out.println( o.getY().getX()); 31. } 32. } Which three code fragments, added individually at line 29, produce the output 100?()An = 100;Bi.setX( 100);Co.getY().setX( 100);Di = new Inner(); i.setX( 100);Eo.setY( i); i = new Inner(); i.setX( 100);Fi = new Inner(); i.setX( 100); o.setY( i);
考题
多选题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?()Astatic class InnerOne { public double methoda() {return d1;} }Bstatic class InnerOne { static double methoda() {return d1;} }Cprivate class InnerOne { public double methoda() {return d1;} }Dprotected class InnerOne { static double methoda() {return d1;} }Epublic abstract class InnerOne { public abstract double methoda(); }
考题
多选题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 }Anative public void setTemperature(int kelvin);Bprivate native void setTemperature(int kelvin);Cprotected int native getTemperature();Dpublic abstract native void setTemperature(int kelvin);Enative int setTemperature(int kelvin) {}
考题
多选题Which two statements are true?()AAn inner class may be declared as static.BAn anonymous inner class can be declared as public.CAn anonymous inner class can be declared as private.DAn anonymous inner class can extend an abstract class.EAn anonymous inner class can be declared as protected.
考题
多选题1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3?()Astatic class InnerOne { public double methoda() { return d1; } }Bstatic class InnerOne { static double methoda() { return d1; } }Cprivate class InnerOne { public double methoda() { return d1; } }Dprotected class InnerOne { static double methoda() { return d1; } }Epublic abstract class InnerOne { public abstract double methoda(); }
考题
多选题class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()Apublic void foo() { }Bpublic int foo() { return 3; }Cpublic Two foo() { return this; }Dpublic One foo() { return this; }Epublic Object foo() { return this; }
考题
多选题10. abstract public class Employee { 11. protected abstract double getSalesAmount(); 12. public double getCommision() { 13. return getSalesAmount() * 0.15; 14. } 15. } 16. class Sales extends Employee { 17. // insert method here 18. } Which two methods, inserted independently at line 17, correctly complete the Sales class?()Adouble getSalesAmount() { return 1230.45; }Bpublic double getSalesAmount() { return 1230.45; }Cprivate double getSalesAmount() { return 1230.45; }Dprotected double getSalesAmount() { return 1230.45; }
考题
单选题public class returnIt ( returnType methodA(byte x, double y) ( return (short) x/y * 2; ) ) What is the valid returnType for methodA in line 2?()A
IntB
ByteC
LongD
ShortE
FloatF
Double
考题
多选题Which the following two statements are true?()AAn inner class may be declared as static.BAn anonymous inner class can be declared as public.CAn anonymous inner class can be declared as private.DAn anonymous inner class can extend an abstract class.EAn anonymous inner class can be declared as protected.
考题
单选题Which will declare a method that is available to all members of the same package and can be referenced without an instance of the class?()A
Abstract public void methoda();B
Public abstract double methoda();C
Static void methoda(double d1){}D
Public native double methoda(){}E
Protected void methoda(double d1){}
热门标签
最新试卷