题目内容

public class MyLogger { private StringBuilder logger = new StringBuuilder(); public void log(String message, String user) { logger.append(message); logger.append(user); } } The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?()

A. synchronize the log method
B. replace StringBuilder with StringBuffer
C. No change is necessary, the current MyLogger code is already thread-safe.
D. replace StringBuilder with just a String object and use the string concatenation (+=) within the log method

查看答案
更多问题

单缓柱塞阀排气口漏风是何原因?

办理结账手续是宾客离店前接受酒店所提供的最后一项服务,许多酒店规定办理结账退房的时间不超过()。

A. 2分钟
B. 3分钟
C. 5分钟
D. 8分钟

气液两相处于平衡时,()相等。

简述儿童发展心理学研究的一般过程。

答案查题题库