如下面的代码:
public class Test
{
public static void main(String args[])
{
AA a = new AA();
a.start();
BB b = new BB();
Thread t = new Thread(b);
t.start();
}
}
class AA extends Thread
{
public void run()
{
System.out.println("1");
}
public void start()
{
System.out.println("2");
}
}
class BB implements Runnable
{
public void run()
{
System.out.println("3");
}
public void start()
{
System.out.println("4");
}
}
输出如下:
2
3