更多"创建一个线程之后,通过调用该线程对象的______方法将潜入该线程的虚"的相关试题:
[填空题]线程生命周期有几种状态,分别是创建状态、可运行状态、 【6】 、不可运行状态和死亡状态。
[填空题]当使用Threadt=newThread(r)创建一个线程时,表达式:rinstanceofThread的值是【 】。
[填空题]当使用Threadt=mewThread(r)创建一个线程时,表达式:rinstrance of Thread的值是______。
[单项选择]当使用SomeThread t=new SomeThread( )创建一个线程时,下列叙述中正确的是______。
A. SomeThread类是包含run()方法的任意Java类
B. SomeThread类一定要实现Runnable接口
C. SomeThread类是Thread类的子类
D. SomeThread类是Thread类的子类并且要实现Runnable接口
[填空题]当使用Thread t=new Thread(r)创建一个线程时,表达式:r instranceof Thread的值是______。
[填空题]当使用Thread t=new Thread(r)创建一个线程时,表达式:r instanceof Thread的值是______。
[单项选择]下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run( ) System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start ( ); } }
A. new MyRun(m
B. new Thread()
C. new Thread(m
D. Thread(m
[单项选择]下列方法中可以用来创建一个新线程的是()。
A. 实现javA.lang.Runnable接口并重写start()方法
B. B.实现javlang.Runnable接口并重写run()方法
C. C.继承javlang.Thread类并重写run()方法
D. D.实现javlang.Thread类并实现start()方法
[填空题]使得线程放弃当前分得的CPU时间,但不使线程阻塞,即线程仍处于可执行状态,随时可能再次分得CPU时间的方法是 【10】 。