当前位置: 技术问答>java相关
请教一个简单问题,谢谢
来源: 互联网 发布时间:2015-02-22
本文导语: 这个程序编译无法通过,提示在super(Name);tr1= new TalkingThread("线程1",tf); tr2= new TalkingThread("线程2",tf);出错,请教 import java.awt.*; import java.lang.*; class TalkingThread extends Thread{ private TalkFrame t; public void Ta...
这个程序编译无法通过,提示在super(Name);tr1= new TalkingThread("线程1",tf);
tr2= new TalkingThread("线程2",tf);出错,请教
import java.awt.*;
import java.lang.*;
class TalkingThread extends Thread{
private TalkFrame t;
public void TalkingThread(String Name,TalkFrame t){
super(Name);
this.t=t;
}
public void run(){
t.print(getName(),"闲扯");
}
}
public class TalkFrame extends Frame{
static TextArea t1;
public TalkFrame(){
super("计算测试");
t1=new TextArea();
add(t1);
pack();
show();
}
public synchronized void print(String Speaker,String Content){
for (int i=0;i
tr2= new TalkingThread("线程2",tf);出错,请教
import java.awt.*;
import java.lang.*;
class TalkingThread extends Thread{
private TalkFrame t;
public void TalkingThread(String Name,TalkFrame t){
super(Name);
this.t=t;
}
public void run(){
t.print(getName(),"闲扯");
}
}
public class TalkFrame extends Frame{
static TextArea t1;
public TalkFrame(){
super("计算测试");
t1=new TextArea();
add(t1);
pack();
show();
}
public synchronized void print(String Speaker,String Content){
for (int i=0;i