网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

Which two are true?()

  • A、 An encapsulated, public class promotes re-use.
  • B、 Classes that share the same interface are always tightly encapsulated.
  • C、 An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
  • D、 An encapsulated class allows a programmer to change an implementation without affecting outside code.

参考答案

更多 “Which two are true?()A、 An encapsulated, public class promotes re-use.B、 Classes that share the same interface are always tightly encapsulated.C、 An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.D、 An encapsulated class allows a programmer to change an implementation without affecting outside code.” 相关考题
考题 void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?() A、 This code may throw an InterruptedException.B、 This code may throw an IllegalStateException.C、 This code may throw a TimeoutException after ten minutes.D、 This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.E、 Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.F、 A call to notify() or notifyAll() from another thread may cause this method to complete normally.

考题 import java.util.*;  public class PQ {  public static void main(String[] args) {  PriorityQueue pq = new PriorityQueue();  pq.add(”carrot”); pq.add(”apple”);  pq.add(”banana”);  System.out.println(pq.poll() +”:” + pq.peek()); }  }  What is the result?() A、 apple:appleB、 carrot:appleC、 apple:bananaD、 banana:appleE、 carrot:carrotF、 carrot:banana

考题 现有:  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);}

考题 ClassOne.java   package com.abc.pkg1;   public class ClassOne {   private char var = ‘a‘;   char getVar() {return var;}   }   ClassTest.java   package com.abc.pkg2;   import com.abc.pkg1.ClassOne;   public class ClassTest extends ClassOne {  public static void main(Stringargs) {  char a = new ClassOne().getVar();  char b = new ClassTest().getVar();   }   }   What is the result?()  A、 Compilation will fail.B、 Compilation succeeds and no exceptions are thrown.C、 Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.D、 Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.

考题 下面哪种情况会导致持久区jvm堆内存溢出()。A、循环上万次的字符串处理B、在一段代码内申请上百M甚至上G的内存C、使用CGLib技术直接操作字节码运行,生成大量的动态类D、不断创建对象

考题 1. int I=1, j=0  2.    3. switch(i)  {  4. case 2:  5. j+=6;  6.    7. case 4:  8. j+=1;  9.    10. default:  11. j +=2;  12.    13. case 0:  14. j +=4;  15. }  16.      What is the value of j at line 16?()A、 0B、 1C、 2D、 4E、 6