System.out.println() synchronized?

M

Mashrur Mia

Hello All,

Is System.out.println() synchronized?. Of course I haven't seen two
threads calling println() messing up each other's output so far (so
far! I haven't been that far perhaps). But the API in www.java.sun.com
does not say if the function is sync or not. Since I don't know what's
happening in println, so is println() atomic otherwise?

(when I searched in google, some site mirroring java.io.PrintStream
APIs say println() is sync)

please help
Sa'ad
 
C

Christophe Vanfleteren

Mashrur said:
Hello All,

Is System.out.println() synchronized?. Of course I haven't seen two
threads calling println() messing up each other's output so far (so
far! I haven't been that far perhaps). But the API in www.java.sun.com
does not say if the function is sync or not. Since I don't know what's
happening in println, so is println() atomic otherwise?

(when I searched in google, some site mirroring java.io.PrintStream
APIs say println() is sync)

please help
Sa'ad

Yes, System.out.println is synchronized.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top