Given that t1 is a reference to a live thread, which is true?() A.The Thread.sleep() method can take t1 as an argument.B.The Object.notify() method can take t1 as an argument.C.The Thread.yield() method can take t1 as an argument.D.The Thread.setPriority() method can take t1 as an argument.E.The Object.notify() method arbitrarily chooses which thread to notify.

Given that t1 is a reference to a live thread, which is true?()

A.The Thread.sleep() method can take t1 as an argument.

B.The Object.notify() method can take t1 as an argument.

C.The Thread.yield() method can take t1 as an argument.

D.The Thread.setPriority() method can take t1 as an argument.

E.The Object.notify() method arbitrarily chooses which thread to notify.


相关考题:

Given:fooandbararepublicreferencesavailabletomanyotherthreads,fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?()A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notifyAll();F.Object.notify();

publicclassTest{publicstaticvoidmain(String[]args){booleanassert=true;if(assert){System.out.println(”assertistrue”);}}}Given:javac-source1.3Test.javaWhatistheresult?() A.Compilationfails.B.Compilationsucceedswitherrors.C.Compilationsucceedswithwarnings.D.Compilationsucceedswithoutwarningsorerrors.

publicclassAextendsThread{A(){setDaemon(true);}publicvoidrun(){(newB()).start();try{Thread.sleep(60000);}catch(InterruptedExceptionx){}System.out.println(Adone”);}classBextendsThread{publicvoidrun(){try{Thread.sleep(60000);}catch(InterruptedExceptionx){}System.out.println(Bdone”);}}publicstaticvoidmain(String[]args){(newA()).start();}}Whatistheresult?()A.AdoneB.BdoneC.AdoneBdoneD.BdoneAdoneE.Thereisnoexceptionthattheapplicationwillprintanything.F.Theapplicationoutputs“Adone”and“Bdone”,innoguaranteedorder.

Thefilefile.txt”existsonthefilesystemandcontsinsASCIItext.Given:try{Filef=newFile(file.txt”);OutputStreamout=newFileOutputStream(f,true);}catch(IOException){}Whatistheresult?() A.Thecodedoesnotcompile.B.Thecoderunsandnochangeismadetothefile.C.Thecoderunsandsetsthelengthofthefileto0.D.Anexceptionisthrownbecausethefileisnotclosed.E.Thecoderunsanddeletesthefilefromthefilesystem.

Given:12.Stringcsv=Sue,5,true,3;13.Scannerscanner=newScanner(csv);14.scanner.useDelimiter(,);15.intage=scanner.nextInt();Whatistheresult?() A.Compilationfails.B.Afterline15,thevalueofageis5.C.Afterline15,thevalueofageis3.D.Anexceptionisthrownatruntime.

Given:fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whatprovidesthemostreliablewaytoensurethatfoowillstopexecutingwait()?A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notifyAll();

下列程序通过设定线程优先级,抢占主线程的CPU,选择正确的语句填入横线处。 class T14 implements Runnable { private Boolean fStop - true; public void run() { while(fStop) { System.out.println(Thread.currentThread().getName() + "run"); try { Thread.sleep(l); } catch(Exception e) { e.printStackTrace(); } } } public void stopRun() { fStop = false; } } public class Testl4 { public static void main(String[] args) { T14 t14 = new T14(); Thread t1 = new Thread(ti4, "T14"); Thread t = Thread.currentThread()'; ______; Ti.start(); T14.stopRun(); System.out.println ( "stop "); } }A.setPriority(Thread. MIN_PRIORITY)B.t1 .setPriority(Thread. MIN_PRIORITY)C.t.setPfiofity(Thread. MIN_PRIORITY)D.t14.setPriority(Thread. MIN_PRIORITY)

下列程序的执行结果是______。 class A5 extends Thread { boolean b; A5 (boolean bb) { b = bb; } public void run() { System.out.println(this.getName() + "运行"); } } public class Testl5 { public static void main(String[] args) { A5 a1 = new A5(true); A5 a2 = new A5(false); if(a1.b) A1.start(); if (a2 .b) A2.start(); } }A.Thread-0B.Thread-1C.Thread-0D.Thread-1 Thread-1 Thread-0

下列程序的输出结果是______。 class T44 implements Runnable { public void run() { System.out.print in (Thread.currentThread ( ).getName ( ) + "运行" ); } } public class ex44 { public static void main(String[] args) { Thread t1 = new Thread(new T44(), "t1"); Thread t2 = new Thread(new T44 () , "t2"); t1 .setPriority(Thread. MAX_PRIORITY); t2.setPriority(Thread.MIN_PRIORITY); t2. start (); t1 .start (); } }A.t1 运行 t2 运行B.t2 运行 t1 运行C.t1 运行 t1 运行D.t2 运行 t2 运行

【单选题】下列哪个命令可以下载HDFS目录/user/root/live.txtA.hdfs dfs -get /user/root/live.txtB.hdfs dfs -download /user/root/live.txtC.hdfs dfs -put /user/root/live.txtD.hdfs dfs -move /user/root/live.txt