PrintWriter是线程安全的吗?

问题描述 投票:8回答:6

鉴于以下内容:

public class CConsole {
  public static PrintWriter pw = new PrintWriter(System.out, true);
}

CConsole.pw.format("%d %d", x, y)线程安全吗?也就是说,多个线程可以使用此调用吗?它被描述为线程安全的位置。我没有在PrintWriter类描述中看到它,也没有在format()方法描述中看到它。

java printwriter
6个回答
© www.soinside.com 2019 - 2024. All rights reserved.