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.

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.

相关考题:

Given:Which four code fragments, inserted independently at line 7, will compile?() A.public void m1() { }B.protected void m1() { }C.private void m1() { }D.void m2() { }E.public void m2() { }F.protected void m2() { }G.private void m2() { }

下面正确的函数定义形式为( )。A.void fun();{}B.void fun(int x;int y) {}C.void fun() {}D.void fun(int x,y) {}

下面程序段中的错误语句是 ______。 class M{ int i; public: void ~AA(int); AA *p; void AA(); void AA(int x){i=x;}; };A.AA *p;B.void ~AA(int);C.void AA(int);D.void AA(int x){i=x;};

void test(void)

6:写内存拷贝函数 原型给出 void*mymemcpy(void*dest,void*src,int count)

请写出下面的输出:class B{public:virtual void Print(void){printf(“B::Print\n”);}virtual void Reprint(void){printf(“B:Reprint\n”);}void Algo(void){Print();Reprint();}};class D : public B{public:virtual void Print(void){printf(“D::Print\n”);}};void main(){B *p = new D();p-Print();p-Algo();}

下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

下面的说明中,正确的函数定义是( )。A.void fun(void)B.void fun(void){}C.fun(int s){}D.fun(int s){return s+1;}

下面正确的函数定义是( )。A.Fun()B.void funC.void fun()D.void fun(){}

下列方法定义中,()是抽象方法。 A、 static void func(){  }B、 virtual void func(){  }C、 abstract void func(){  }D、 overridel void func(){  }

interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

Which two declarations prevent the overriding of a method? ()A、 Final void methoda(){}B、 Void final methoda(){}C、 Static void methoda(){}D、 Static final void methoda(){}E、 Final abstract void methoda(){}

哪二种声明防止方法覆盖?()A、final void methoda() {}B、void final methoda() {}C、static void methoda() {}D、static final void methoda() {}E、final abstract void methoda() {}

可以限制一个方法重载的声明语句有()。A、final void methoda(){}B、void final methoda(){}C、static final void methoda(){}D、static void methoda(){}E、final abstract void methoda(){}

作为类中新线程的开始点,线程的执行是从()方法开始的。A、public void start()B、public void run()C、public void int()D、public static void main(Stringargs[])

下面那一个函数是线程的入口函数? ()A、private void run()B、public void run()C、public void start()D、public void begin()

Which method must be defined by a class implementing the java.lang.Runnable interface? () A、 void run()B、 public void run()C、 public void start()D、 void run(int priority)E、 public void run(int priority)F、 public void start(int priority)

下面哪些方法禁止子类重定义该方法()A、protected void m(){}B、final void m(){}C、abstractfinal void m (){}D、staticfinal void m(){}

单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A void run()B public void run()C public void start()D void run(int priority)E public void run(int priority)F public void start(int priority)

单选题interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()A public class Employee extends Info implements Data { public void load() { /*do something*/ } }B public class Employee implements Info extends Data { public void load() { /*do something*/ } }C public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

单选题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.

多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() {public void run() { doStuff(); }};Bnew Thread() {public void start() { doStuff(); }};Cnew Thread() {public void start() { doStuff(); }}.run();Dnew Thread() {public void run() { doStuff(); }}.start();Enew Thread(new Runnable() {public void run() { doStuff(); }}).start();

多选题下面哪些方法禁止子类重定义该方法()Aprotected void m(){}Bfinal void m(){}Cabstractfinal void m (){}Dstaticfinal void m(){}

多选题哪二种声明防止方法覆盖?()Afinal void methoda() {}Bvoid final methoda() {}Cstatic void methoda() {}Dstatic final void methoda() {}Efinal abstract void methoda() {}

多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() { public void run() { doStuff(); } }Bnew Thread() { public void start() { doStuff(); } }Cnew Thread() { public void start() { doStuff(); } } .run();Dnew Thread() { public void run() { doStuff(); } } .start();Enew Thread(new Runnable() { public void run() { doStuff(); } } ).run();Fnew Thread(new Runnable() { public void run() { doStuff(); } }).start();

多选题可以限制一个方法重载的声明语句有()。Afinal void methoda(){}Bvoid final methoda(){}Cstatic final void methoda(){}Dstatic void methoda(){}Efinal abstract void methoda(){}

多选题Given: Which four code fragments, inserted independently at line 7, will compile?()Apublic void m1() { }Bprotected void m1() { }Cprivate void m1() { }Dvoid m2() { }Epublic void m2() { }Fprotected void m2() { }