Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个主线程和一个子线程,例如Thread childThread。
Thread childThread
如何将数据传递给childThread System.in以及如何从中获取数据childThread System.out?
childThread
System.in
System.out
您可以使用Exchanger交换数据。另一种方法是实现BlockingQueue。