You're already creating an instance of the Thread class - you're just not doing anything with it. You could call start()
without even using a local variable:
new Thread()
{
public void run() {
System.out.println("blah");
}
}.start();
... but personally I'd normally assign it to a local variable, do anything else you want (e.g. setting the name etc) and then start it:
Thread t = new Thread() {
public void run() {
System.out.println("blah");
}
};
t.start();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…