难道说用构造方法也能调用方法?
class MultiThread
{
public static void main(String[] args)
{
MyThread mt=new MyThread();
new Thread(mt).start();//这里怎么用构造方法调用方法呢 ?这样可以么 ?难道说用构造方法也能调用方法?
while(true)
{
System.out.println("main:"+Thread.currentThread().getName());
}
}
}
class MyThread implements Runnable
{
public void run()
{
while(true)
System.out.println(Thread.currentThread().getName());
}
}