多选题11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected

题目
多选题
11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()
A

final

B

static

C

native

D

public

E

private

F

abstract

G

protected

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

10. public class Bar {  11.static void foo(int...x) {  12. // insert code here  13. }  14. }  Which two code fragments, inserted independently at line 12, will allow the class to compile?()

  • A、 foreach(x) System.out.println(z);
  • B、 for(int z : x) System.out.println(z);
  • C、 while( x.hasNext()) System.out.println( x.next());
  • D、 for( int i=0; i< x.length; i++ ) System.out.println(x[i]);

正确答案:B,D

第2题:

1. class Super {  2. private int a;  3. protected Super(int a) { this.a = a; }  4. }  .....  11. class Sub extends Super {  12. public Sub(int a) { super(a); }  13. public Sub() { this.a= 5; }  14. }  Which two, independently, will allow Sub to compile?()

  • A、 Change line 2 to: public int a;
  • B、 Change line 2 to: protected int a;
  • C、 Change line 13 to: public Sub() { this(5); }
  • D、 Change line 13 to: public Sub() { super(5); }
  • E、 Change line 13 to: public Sub() { super(a); }

正确答案:C,D

第3题:

10. class Foo {  11. static void alpha() { /* more code here */ }  12. void beta() { /* more code here */ }  13. }  Which two are true?()

  • A、 Foo.beta() is a valid invocation of beta().
  • B、 Foo.alpha() is a valid invocation of alpha().
  • C、 Method beta() can directly call method alpha().
  • D、 Method alpha() can directly call method beta().

正确答案:B,C

第4题:

11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()

  • A、 final
  • B、 static
  • C、 native
  • D、 public
  • E、 private
  • F、 abstract
  • G、 protected

正确答案:A,B,D

第5题:

11. public class Counter {  12. public static void main(String[] args) {  13. int numArgs = /* insert code here */;  14. }  15. }  and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?() 

  • A、 args.count
  • B、 args.length
  • C、 args.count()
  • D、 args.length()
  • E、 args.getLength()

正确答案:B

第6题:

10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?() 

  • A、 Point p = new Point();
  • B、 Line.Point p = new Line.Point();
  • C、 The Point class cannot be instatiated at line 15.
  • D、 Line 1 = new Line() ; 1.Point p = new 1.Point();

正确答案:B

第7题:

10. interface Foo { int bar(); }  11. public class Sprite {  12. public int fubar( Foo foo) { return foo.bar(); }  13. public void testFoo() {  14. fubar(  15. // insert code here  16.);  17. }  18. }  Which code, inserted at line 15, allows the class Sprite to compile?() 

  • A、 Foo { public int bar() { return 1; } }
  • B、 new Foo { public int bar() { return 1; } }
  • C、 newFoo() { public int bar(){return 1; } }
  • D、 new class Foo { public int bar() { return 1; } }

正确答案:C

第8题:

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 */ }

正确答案:B,C,E

第9题:

10. class Nav{  11. public enum Direction { NORTH, SOUTH, EAST, WEST }  12. }  13. public class Sprite{  14. // insert code here  15. }  Which code, inserted at line 14, allows the Sprite class to compile?() 

  • A、 Direction d = NORTH;
  • B、 Nav.Direction d = NORTH;
  • C、 Direction d = Direction.NORTH;
  • D、 Nav.Direction d = Nav.Direction.NORTH;

正确答案:D

第10题:

10. public class Foo implements java.io.Serializable {  11. private int x;  12. public int getX() { return x; }  12.publicFoo(int x){this.x=x; }  13. private void writeObject( ObjectOutputStream s)  14. throws IOException {  15. // insert code here  16. }  17. }  Which code fragment, inserted at line 15, will allow Foo objects to be correctly serialized and deserialized?() 

  • A、 s.writeInt(x);
  • B、 s.serialize(x);
  • C、 s.writeObject(x);
  • D、 s.defaultWriteObject();

正确答案:D

更多相关问题