java 12.运行下列程序,会产生的结果是 ( A )
来源:百度知道 编辑:UC知道 时间:2024/05/29 04:13:32
public class X extends 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();
}
}
public void run(){
System.out.println(〃this is run()〃);
}
public static void main(String args〔〕)
}
Thread t=new Thread(new X());
t.start();
}
}
代码有点点小错误 更正如下
public class X extends Thread implements Runnable {
public void run() {
System.out.println("This a run()");
}
public static void main(String args[]) {
Thread t = new Thread(new X());
t.start();
}
}
___________________
Runable改为 Runnable
输出的 结果为
This a run()
public class X extends 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();
System.out.println("thread main");
}
}
为了理解线程的话,后面加上一句,那么输出结果是:
thread main
this is run()
没有定义接口,没有start()方法,好多东西没有联系性。
建议把整个程序都写上~
大哥,你至少说明白是啥意思吧……啥叫A啊