SCJP的implement的問題?

Which two classes correctly implement both the java.lang.Runnable and the java.lang.Clonable interfaces? (Choose two.) A. public class Session implements Runnable, Clonable { public void run(); public Object clone(); } B. public class Session extends Runnable, Clonable { public void run() { / do something */... 顯示更多 Which two classes correctly implement both the java.lang.Runnable
and the java.lang.Clonable interfaces? (Choose two.)
A. public class Session
implements Runnable, Clonable {
public void run();
public Object clone();
}
B. public class Session
extends Runnable, Clonable {
public void run() { / do something */ }
public Object clone() { / make a copy */ }
}
C. public class Session
implements Runnable, Clonable {
public void run() { / do something */ }
public Object clone() { /* make a copy */ }
}
D. public abstract class Session
implements Runnable, Clonable {
public void run() { / do something */ }
public Object clone() { /*make a copy */ }
}
E. public class Session
implements Runnable, implements Clonable {
public void run() { / do something */ }
public Object clone() { / make a copy */ }
}
Answer: CD
請問一下為什麼選項B錯誤呢?
謝謝!

還有
11.classA {
12. public void process() { System.out.print(”A “); } }
13. class B extends A {
14. public void process() throws RuntimeException {}}
這樣有會overloading嗎?謝謝!
更新: 1. public interface A {
2. String DEFAULT_GREETING = “Hello World”;
3. public void method1();
4. }
A programmer wants to create an interface called B that has A as its parent.
A. public interface B extends A { }
Answer: A
如果說不可以用extends interface
為什麼這題答案會是A呢?
難道只因為parent嗎?
謝謝你的回答!
2 個解答 2