当使用Thread t=new Thread(r)创建一个线程时,表达式:r instanceo Thread的值是【 】。
当使用Thread t=new Thread(r)创建一个线程时,表达式:r instanceo Thread的值是【 】。
当使用Thread t=new Thread(r)创建一个线程时,表达式:r instanceo Thread的值是【 】。
当使用Thread t=new Thread(r)创建一个线程时,表达式:r instanceof Thread的值是【 】。
下面程序的功能在监控台上每隔一秒钟显示一个字符串"Hello!"。
public class Class31 implements Runnable
{
public static void main(String args[])
{
Class31 t=new Class31();
Thread tt=new Thread(t);
tt.start();
}
public void run()
{
for(;;)
{
try{
();
}catch(()){}
System.out.println("Hello");
}
}
}
运行下列程序,会产生什么结果? () public class X exlends Thread implements Runable{ public void run(){ System.out.println("this is run()"); } public static void main(String args[]) Thread t=new Thread(new X()); t.start(); } }
A.第一行会产生编译错误
B.第五行会产生编译错误
C.第六行会产生运行错误
D.程序会运行和启动
听力原文:M: Oh, my shirt sleeve. Must have gotten caught on that nail.
W: Here, let me take a look.
M: What do you think of it?
W: Hmm with a needle and thread, this can be mended and look just like new.
What does the woman think about the shirt?
A.The man will have to buy a new shirt.
B.The shirt looks just like the man's new one.
C.The shirt can be repaired easily.
D.The man shouldn't put sharp objects in his shirt pocket.
Public cclass My Thread extends Thread implements Runnable{
Public void run(){
}
Public static void main(String[]args){
Threadt=new Thread(new My Thread());
t.start();
}
}
A.第一行会产生编译错误
B.第六行会产生编译错误
C.第六行会产生运行错误
D.程序会运行和启动
A.public class MyRunnable extends Runnable{public void run(){}}
B.public class MyRunnable extends Object{public void run(){}}
C.public class MyRunnable implements Runnable{public void run(){}}
D.public class MyRunnable extends Runnable{void run(){}}