Possible Duplicate:
Java: System.out.println and System.err.println out of order
Why this code
System.err.println("err");
System.out.println("out");
prints
out
err
on Eclipse console?
UPDATE
The same code prints in correct order if I run it from command line.
UPDATE
If I fix it as
System.err.println("err");
Thread.sleep(5);
System.out.println("out");
It prints correctly in Eclipse too
It's not slower; they're just not necessarily flushed in order. You can fix that, however:
System.err.println("err");
System.err.flush();
System.out.println("out");
Okay, so this appears to be a known Eclipse bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=32205
来源:https://stackoverflow.com/questions/13656681/why-is-system-err-slower-than-system-out-in-eclipse