--异步
Thread t3 = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < 10; i++) {
Thread.sleep(1100);
System.out.println("4:"
+ i);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});t3.start();
--同步
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
}
});
t3.isAlive()
Java's synchronous and asynchronous simple use of a method
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326794552&siteId=291194637
Recommended
Ranking