Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Console behaviour in Java

 
Nick Widelec
Ranch Hand
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Directly from the official API:

Invoking close() on the objects returned by the reader() and the writer() will not close the underlying stream of those objects.


Why the object would not get close even invoking close()?

Thanks in advance.


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick,
It looks like Java has a singleton reader. The following code returns true. This means that if the reader were closes, no other code could call it later.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic