单项选择题

为了保证方法的线程安全,声明方法的时候必须用哪个修饰符?()

A.new
B.transient
C.void
D.synchronized