What method call is used to tell a thread that it has the opportunity to run?
a.wait()
b.notify()
c.start()
d.run()答案是b,可我觉得c 也对,大家说说自己的看法哈

解决方案 »

  1.   

    b is the right answer.what is the meaning of that has opportunity?think it over.
      

  2.   

    start() is start a thread which hasn't run 
      

  3.   

    to ninthac不一定马上运行,而是使线程从new状态进入runable可运行状态,可能在等待cup资源,因为cpu同时只能运行一个线程。
    而b则是让线程进入lock pool,等待对象的锁被其他线程释放,一旦释放就运行所以opportunity这个词,用的有毛病
      

  4.   

    start肯是不对的,它不会告诉这个thread可以运行了,而是会告诉某个调度程序,这个thread可以运行了.
      

  5.   

    start 之后就肯定会运行的,但是notify之后是有可能,因为可能被等待同一个锁的其他线程抢先执行
      

  6.   

    我是看SCJP的书把头搞晕了。
    按照书上说的:
    calling your thread's start() method doesn't immediately cause the thread to run ; it just      
    makes the thread eligible to run.The thread must still contend for CPU time with oter threads.
    照这样说,start()方法也是让线程有机会运行,不过按rainly1985(鹏)的说法“start 之后就肯定会运行的,但是notify之后是有可能”,这样理解的话,start()就不是精确答案了。shenpipi(皮皮) 从调度者和被调度者的观点来看,感觉不是关键所在。两个方法的用法还是明确的,就是感觉题目有点迷糊
    附notify()的用法:
    The notify() method arbitrarily selects one of the threads in the monitor's wating pool and  
    moves it to the Seeking Lock State.
      

  7.   

    搞那么清楚干什么?反正自己心里明白就行了.学java又不是为了做题.
      

  8.   

    please read the question once more, everyone.
    It means when can the current object can be accessed by some threads but not when the thread can run.
    So b is the correct answer.If the question is changed to be what method call is used to tell a thread that it can be run? So the answer is C.
    But why isnot d.
    Bucause as usual, run method will not be intented to be called directed. Instend, we should call the method start, and then the thread object will call the run method to do the exactly job automatically.
      

  9.   

    偶准备下周考SCJP啊,兄弟
    What method call is used to tell a thread that it has the opportunity to run?what method call is used to tell a thread that it can be run?有区别吗?
    shenpipi(皮皮)说的还有点想得通“
    start 之后就肯定会运行的,但是notify之后是有可能,因为可能被等待同一个锁的其他线程抢先执行”