• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writer() method of Console

 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Niko's blog



I thought that the last line will give a runtime error, since the Writer associated with console is closed. But it goes on to print "Hello".

Could anybody explain this please?

Thanks!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for the java.io.Console class says : Invoking close() on the objects returned by the reader() and the writer() will not close the underlying stream of those objects.
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting. Thanks, Christophe!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic