This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes System.flush() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.flush() ?" Watch "System.flush() ?" New topic
Author

System.flush() ?

Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
The text is unclear what this method does, but said that sometimes what you should see on the screen is not there, and using this method can help with that. I shrugged it off, but earlier, one of my message boxes came up blank. I closed it, and the program continued as if nothing had happened, so I'm guessing I could have used System.flush() somehwere? How do I know when and where to use it?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

It's System.out.flush(). Basically, you need to use it if you call System.out.print() (not println()) and want the output to appear on the screen right away, as opposed to later after the next println() call. It won't affect GUI message boxes at all -- it's only related to console output.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: System.flush() ?
 
Similar Threads
Comparing elements in a sets?
destroy() method of servlet.
what happens if i call destroy() method in init() or service() method ?
remove method
How can you make an array grow