• Post Reply Bookmark Topic Watch Topic
  • New Topic

how redirection is heppen in System class where all three Stream variable is final

 
chain singh
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how redirection is heppen in System class where all three Stream variable is final ???
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chain singh wrote:how redirection is heppen in System class where all three Stream variable is final ???


Are you asking how redirection can happen in the command shell? Such as this?


If that's your question, it has nothing to do with Java. System.out hasn't changed. It's still sending its data to the same place. It's the shell's stdout that has changed from the console to our output file.



If that's not your question, please clarify what you're asking.
 
chain singh
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for reply,

actually i want to know that how setOut() method will work ???

because out is final so how we can Reassigns the "standard" output stream. if its related to shell than please explain me
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chain singh wrote:
actually i want to know that how setOut() method will work ???


That's a special case. It uses a native method to get around the final-ness. (Although you may also be able to do that with reflection. I'm not sure, so I'll leave that as an exercise for you if you're interested.)
 
chain singh
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you , this is very helpful for me
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!