Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7411781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:26:25+00:00 2026-05-29T06:26:25+00:00

In Java, I noticed that sometimes, System.err statements get printed first before System.out statements,

  • 0

In Java, I noticed that sometimes, System.err statements get printed first before System.out statements, although the latter appears first before the former in my code. Why? I’m curious.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:26:26+00:00Added an answer on May 29, 2026 at 6:26 am

    Typically, System.out is a buffered output stream, so text is accumulated before it is flushed to the destination location. This can dramatically improve performance in applications that print large amounts of text, since it minimizes the number of expensive system calls that have to be made. However, it means that text is not always displayed immediately, and may be printed out much later than it was written.

    System.err, on the other hand, typically is not buffered because error messages need to get printed immediately. This is slower, but the intuition is that error messages may be time-critical and so the program slowdown may be justified. According to the Javadoc for System.err:

    Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.

    (My emphasis)

    However, as a result, old data sent to System.out might show up after newer System.err messages, since the old buffered data is flushed later than the message was sent to System.err. For example this sequence of events:

    • “Hello,” is buffered to System.out
    • “PANIC” is sent directly to System.err and is printed immediately.
    • ” world!” is buffered to System.out, and the buffered data is printed

    Would result in the output

    PANIC
    Hello, world!
    

    Even though Hello was printed to System.out before PANIC was printed to System.err.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While using CA Siteminder's JAVA SDK API we noticed a starnge issue that sometimes
I just noticed that you can do System.out.println(FooObject.fooNumber = 4); which will assign 4
am working on a java(tomcat) app. that sometimes writes to stdout. But I notice
I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public
I just installed Eclipse Galileo for Java developers and noticed that the update site
I noticed that the launching of Java applets using deployJava.js seems to have stopped
We noticed that lots of bugs in our software developed in C# (or Java)
I was looking at the Java code for LinkedList and noticed that it made
I'm relatively new to Threading in Java and I've noticed that everytime I use
I have noticed in Java that you can have a function with object... as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.