10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C()); 23. for (A a:list) { 24. a.x(); 25. a.y();; 26. } What is the result?()
Which class defines the contract that ASP.NET implements to provide membership services using custom membership providers?()
class Work implements Runnable { Thread other; Work(Thread other) { this.other = other; } public void run() { try { other.join(); } catch (Exception e) { } System.out.print("after join "); } } class Launch { public static void main(String [] args) { new Thread(new Work(Thread.currentThread())).start(); System.out.print("after start "); } } 结果为:()
1. interface I { void go(); } 2. 3. abstract class A implements I { } 4. 5. class C extends A { 6. void go(){ } 7. } 结果是什么?()
class Order3 implements Runnable { public static void main(String [] args) { new Thread(new Order3()).start(); for(int x = 0; x 〈 10; x++) System.out.print("m"); } public void run() { for(int x = 0; x 〈 10; x++) { //insert code here System.out.print("r"); } } } 和: 当代码被编译并照此运行时产生 "before" 的输出, 当下列内容插入到代码第8行时产生"after"输出 if (x 〉 3 && x 〈 7) Thread.yield(); 对比“before”的输出结果和“after”的输出结果,下面哪一项是正确的?()
public class X implements Runnable ( private int x; private int y; public static void main(String args) ( X that = new X(); (new Thread(that)) . start( ); (new Thread(that)) . start( ); ) public synchronized void run( ) ( for (;;) ( x++; y++; System.out.printIn(“x = “ + x + “, y = “ + y); ) ) ) What is the result?()
Given that Triangle implements Runnable, and: Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()
class Order implements Runnable { public void run () { try { Thread.sleep (2000) ; } catch (Exception e) System.out.print("in") ; public static void main (String [] args) { Thread t = new Thread (new Order ()) ; t.start () ; System.out.print ("pre ") ; try { t.join () ; } catch (Exception e) { } System.out.print ("post") ; 可产生哪两项结果?()
抽象类可以实现(implements)接口。
接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承实体类(concrete class)?