The Thread.sleep() method can take t1 as an argument.
The Object.notify() method can take t1 as an argument.
The Thread.yield() method can take t1 as an argument.
The Thread.setPriority() method can take t1 as an argument.
The Object.notify() method arbitrarily chooses which thread to notify.
第1题:
A.More memory per thread is beneficial in all scenarios
B.It causes increased overhead due to initial memory allocation
C.It can affect system stability during peak load times, due to swapping
D.It requires increasing the thread_cache_size variable
第2题:
A. Thread creation must be routed through a dispatcher process
B. The local listener may spawn a now process and have that new process create a thread
C. Each Oracle process runs an SCMN thread.
D. Each multithreaded Oracle process has an SCMN thread.
E. The local listener may pass the request to an existing process which in turn will create a thread.
第3题:
( 24 )请阅读下面程序
public class ThreadTest {
public static void main ( String args[ ]){
Thread t1 = new Thread ( new Hello ()):
Thread t2 = new Thread ( new Hello ()):
t l .start ():
t2.start ();
}
}
class Hello implements Runnable {
int i ;
public void run (){
while ( true ) {
System.out.println ( "Hello"+i++ ) ;
if ( i=5 ) break :
}
}
}
该程序创建线程使用的方法是()
A )继承 Thread 类
B )实现 Runnable 接口
C ) t l.start ()
D ) t2.start ()
第4题:
Given the following code fragment: public void create() { Vector myVect; myVect = new Vector(); } Which of the following statements are true?()
第5题:
Which statements concerning the methods notify() and notifyAll() are true?
第6题:
A.It can be any class.
B.No class has access to base.
C.The class must belong to the geometry package.
D.The class must be a subclass of the class Hypotenuse.
第7题:
下列程序的输出结果是______。 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 运行
第8题:
请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { System.out.prinfin("Hello"+i++); if(i=5) break; } } } 该程序创建线程使用的方法是
A.继承Thread类
B.实现Runnable接口
C.t1.start()
D.t2.start()
第9题:
Given this method in a class: public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(‟<‟); buffer.append(this.name); buffer.append(‟>‟); return buffer.toString(); } Which is true?()
第10题:
public class Test{ public static void main( String[] argv ){ // insert statement here } } Which statement, inserted at line 3, produces the following output?() Exception in thread “main” java.lang.AssertionError: true at Test.main(Test.java:3)