单选题您的应用程序运用了两个线程,名分别为thread One和thread Two thread Two..您需要修改代码防止从线程thread One的执行到thread Two的执行完成。您将如何去做?()A 将thread One配置为以较低优先级运行。B 将thread Two配置为以较高优先级运行。C 使用Wait Call back委托同步这两个线程。D 调用thread One的Sleep方法。E 调用thread One的SpinLock方法。

题目
单选题
您的应用程序运用了两个线程,名分别为thread One和thread Two thread Two..您需要修改代码防止从线程thread One的执行到thread Two的执行完成。您将如何去做?()
A

将thread One配置为以较低优先级运行。

B

将thread Two配置为以较高优先级运行。

C

使用Wait Call back委托同步这两个线程。

D

调用thread One的Sleep方法。

E

调用thread One的SpinLock方法。


相似考题
更多“您的应用程序运用了两个线程,名分别为thread One和thread Two thread Two..您需要修改代码防”相关问题
  • 第1题:

    给你如下一段代码:你需要在类中编写更多的代码,用最少的资源每隔30秒去运行DoWork()方法()

    A.Thread.Sleep(30000)

    B.Thread.SpinWait(30000)

    C.Thread.QueueUserWorkItem(30000)

    D.Thread.SpinWait(30)


    参考答案:A

  • 第2题:

    下列程序的运行结果是______。 class A implements Runnable { int a; iht i = 2; A(int x) { a = x; } public void run() { while(i > 0) { System.out.println("线程" + a); i--; } } } public class Testl3 { public static void main(String[] args) { Thread a1 = new Thread(new A(1)); Thread a2 = new Thread(new A(2)); a1.start(); a2.start(); } }

    A.线程1 线程1 线程2 线程2

    B.线程1 线程2

    C.线程1 线程2 线程1 线程2

    D.线程1 线程1 线程1 线程1


    正确答案:A
    解析:类A实现了Runnable接口,并且通过类的构造函数A(int x)传递整型参数给对象作为线程的编号。在run()线程体内,实现打印两个字符串。在main()方法中,用A类的2个对象创建了a1和a2两个线程,当a1和a2开始执行时,从A类的run()方法开始执行。

  • 第3题:

    Thread类的方法中用于修改线程名字的方法是( )。

    A.setName

    B.reviseName

    C.getName

    D.checkAccess


    正确答案:A
    A。【解析】Thread类的其他方法有setName、getName、activeCount和setDaemon等。其中,用于修改线程名字的方法是setName。

  • 第4题:

    Thread类的方法中用于修改线程名字的方法是( )。A.setName( )B.reviseName( )SXB

    Thread类的方法中用于修改线程名字的方法是( )。

    A.setName( )

    B.reviseName( )

    C.getName( )

    D.checkAecess( )


    正确答案:A
    Thread类的其他方法有setName()、get-Name()、activeCount()和setDaemon()等。其中,用于修改线程名字的方法是setName()。

  • 第5题:

    Thread类的哪个方法用来启动线程的运行?()

    A. run()

    B. start()

    C. begin()

    D. execute(Thread t)


    正确答案:B

  • 第6题:

    为应用程序开发人员上班 Certkiller。.com,Certkiller.com 使用 Visual Studio.NET 2005 作为其应用程序开发平台。您正在开发。NET 框架 2.0 Windows 服务应用程序,用于执行需要后台处理的几个短的任务。你不需要有积极管理您的应用程序中的线程,但您是需要确保在执行任务的过程中将执行安全检查。你应该做什么? ()

    A.使用 ThreadPool.queueUserWorkItem。

    B.使用 ThreadPool.UnsafeQueueUserWorkItem。

    C.使用 Thread.Resume。

    D.使用 Thread.Start


    参考答案:A

  • 第7题:

    下面()让线程休眠1分钟。 

    • A、Thread.Sleep(1)
    • B、Thread.Sleep(60)
    • C、Thread.Sleep(1000)
    • D、Thread.Sleep(60000)

    正确答案:D

  • 第8题:

    为应用程序开发人员上班 Certkiller。.com,Certkiller.com 使用 Visual Studio.NET 2005 作为其应用程序开发平台。 您正在开发。NET 框架 2.0 Windows 服务应用程序,用于执行需要后台处理的几个短的任务。 你不需要有积极管理您的应用程序中的线程,但您是需要确保在执行任务的过程中将执行安全检查。 你应该做什么? ()

    • A、使用 ThreadPool.queueUserWorkItem。
    • B、使用 ThreadPool.UnsafeQueueUserWorkItem。
    • C、使用 Thread.Resume。
    • D、使用 Thread.Start

    正确答案:A

  • 第9题:

    您的应用程序运用了两个线程,名分别为thread One和thread Two thread Two..您需要修改代码防止从线程thread One的执行到thread Two的执行完成。您将如何去做?()

    • A、将thread One配置为以较低优先级运行。
    • B、将thread Two配置为以较高优先级运行。
    • C、使用Wait Call back委托同步这两个线程。
    • D、调用thread One的Sleep方法。
    • E、调用thread One的SpinLock方法。

    正确答案:C

  • 第10题:

    单选题
    您的应用程序运用了两个线程,名分别为thread One和thread Two thread Two..您需要修改代码防止从线程thread One的执行到thread Two的执行完成。您将如何去做?()
    A

    将thread One配置为以较低优先级运行。

    B

    将thread Two配置为以较高优先级运行。

    C

    使用Wait Call back委托同步这两个线程。

    D

    调用thread One的Sleep方法。

    E

    调用thread One的SpinLock方法。


    正确答案: E
    解析: 暂无解析

  • 第11题:

    多选题
    Which two code fragments will execute the method doStuff() in a separate thread?()
    A

    new Thread() {public void run() { doStuff(); }};

    B

    new Thread() {public void start() { doStuff(); }};

    C

    new Thread() {public void start() { doStuff(); }}.run();

    D

    new Thread() {public void run() { doStuff(); }}.start();

    E

    new Thread(new Runnable() {public void run() { doStuff(); }}).start();


    正确答案: C,A
    解析: 暂无解析

  • 第12题:

    填空题
    语句Thread thread1=new SomeThreadClass()成功运行后,线程thread1处于生命周期的____状态。

    正确答案: 新建状态
    解析:
    调用一个线程类的构造方法,便创建了一个线程Thread myThread= new MyThreadClass();新建状态的线程还没有分配有关的系统资源,此时线程只能使用start()和stop()两种控制方法。

  • 第13题:

    以下定义线程方法正确的是 ( )

    A.Public Thread();

    B.Public Thread(Runnable target)

    C.Public Thread(ThreadGroup group,Runnable target);

    D.以上都正确


    正确答案:D
    解析:Tread类在JavaAPI的java.lang包中定义,Thread类的构造方法有多个,这些方法的一般构造可以表示如下:publicThread(ThreadGroupgroup,Runnabletarget,Stringname);其中参数的含义是:group—指明该线程所属的线程组;target—提供线程体的对象,线程启动时,该对象的run()方法将被调用;name—线程名称,Java中的每个线程都有自己的名称,如果name为null,则Java自动给线程赋予惟一的名称。上述方法的每个参数都可以为null。不同的参数去null值,就成为Thread类的各种构造方法。所以选项A、B、C的构造方法都是正确的。

  • 第14题:

    当使用SomeThread t=new SomeThread( )创建-个线程时,下列叙述中正确的是( )。

    A.Some Thread类是包含run( )方法的任意Java类

    B.Some Thread类-定要实现Runnable接口

    C.Some Thread类是Thread类的子类

    D.Some Thread类是Thread类的子类并且要实现Run-nable接口


    正确答案:C
    由SomeThreadt=newSomeThread()可知此题是通过继承Thread类来创建线程的。

  • 第15题:

    在多线程程序设计中,如果采用继承Thread类的方式创建线程,则需要重写Thread类的( )方法。

    A.start

    B.10cal

    C.interrupt

    D.run


    正确答案:D
    Thread类本身实现了Runnable接口,所以可以通过继承Thread类,并重写run()方法定义线程体,然后创建该子类的对象创建线程。

  • 第16题:

    在多线程程序设计中,如果采用继承Thread类的方式创建线程,则需要重写Thread类的( )方法。

    A.start

    B.local

    C.interrupt

    D.run


    正确答案:D
    D。【解析]Thread类本身实现了Runnable接口,所以可以通过继承Thread类,并重写run方法定义线程体,然后创建该子类的对象创建线程。

  • 第17题:

    用Thread子类实现多线程的步骤顺序是( )

    A、声明Thread类的子类,创建Thread子类的实例,让线程调用start()方法

    B、声明Thread类的子类,在子类中重新定义run()方法,创建Thread子类的实例

    C、创建Thread子类的实例,让线程调用start()方法

    D、声明Thread类的子类,在子类中重新定义run()方法,创建Thread子类的实例,让线程调用start()方法


    正确答案:A

  • 第18题:

    Thread线程


    正确答案:可作为独立单元被调度的一连串代码。(process进程)

  • 第19题:

    Which two code fragments will execute the method doStuff() in a separate thread?()

    • A、new Thread() {public void run() { doStuff(); }};
    • B、new Thread() {public void start() { doStuff(); }};
    • C、new Thread() {public void start() { doStuff(); }}.run();
    • D、new Thread() {public void run() { doStuff(); }}.start();
    • E、new Thread(new Runnable() {public void run() { doStuff(); }}).start();

    正确答案:D,E

  • 第20题:

    您开发一个应用程序用于完成精确的运算。您需要保证该应用程序尽可能的完成同步复杂的计算。您将如何去做?()

    • A、设置Process Thread对象的Ideal Processor属性。
    • B、设置Process Thread对象的Processor Affinity属性。
    • C、为每个计算调用ThreadPool类的Queue User WorkItem方法。
    • D、将Process.GetCurrentProcess().BasePriority属性设置为High。

    正确答案:C

  • 第21题:

    单选题
    给你如下一段代码: 你需要在类中编写更多的代码,用最少的资源每隔30秒去运行DoWork( )方法()
    A

    Thread.Sleep(30000)

    B

    Thread.SpinWait(30000)

    C

    Thread.QueueUserWorkItem(30000)

    D

    Thread.SpinWait(30)


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    Which statement is true?()
    A

     If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution.

    B

     If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution.

    C

     If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole  consequence of the notify call.

    D

     If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.


    正确答案: A
    解析: 暂无解析

  • 第23题:

    多选题
    Which two code fragments will execute the method doStuff() in a separate thread?()
    A

    new Thread() { public void run() { doStuff(); } }

    B

    new Thread() { public void start() { doStuff(); } }

    C

    new Thread() { public void start() { doStuff(); } } .run();

    D

    new Thread() { public void run() { doStuff(); } } .start();

    E

    new Thread(new Runnable() { public void run() { doStuff(); } } ).run();

    F

    new Thread(new Runnable() { public void run() { doStuff(); } }).start();


    正确答案: D,F
    解析: 暂无解析

  • 第24题:

    填空题
    在多线程程序设计中,如果采用继承Thread类的方式创建线程,则需要重写Thread类的____方法。

    正确答案: run
    解析:
    java.lang中的Thread类是多线程程序设计的基础。Java中的线程体是由线程类的run()方法定义,该方法定义线程的具体行为。可以有两种方式提供run()方法的实现:实现Runnable接口和继承Thread类。如果采用继承Thread类的方式创建线程,则需要重写Thread类的run()方法。