public
static
void
main(String[] args)
throws
Exception {
Thread threadOne =
new
Thread(
new
Runnable() {
public
void
run() {
methodOne();
}
});
Thread threadTwo =
new
Thread(
new
Runnable() {
public
void
run() {
methodTwo();
}
});
// 执行线程
threadOne.start();
threadTwo.start();
Thread.sleep(
1000
);
}
public
static
void
methodOne() {
System.out.println(
"Method one is running!"
);
}
public
static
void
methodTwo() {
System.out.println(
"Method two is running!"
);
}