您好,欢迎访问一九零五行业门户网

java的异步和同步有什么区别

区别
1、异步和同步的区别一般是调用方是否需要等待结果。
2、是否需要等待结果是同步。
3、还可以为是否需要等待结果是异步。
实例
--异步thread t3 = new thread(new runnable() { @overridepublic 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() { @overridepublic void run() {// todo auto-generated method stub }}); t3.isalive()
以上就是java的异步和同步有什么区别的详细内容。
其它类似信息

推荐信息