What is the difference between a stream and a reader in Java?

后端 未结 4 1765
星月不相逢
星月不相逢 2020-12-13 20:49

Today I got this question for which I think I answered very bad. I said stream is a data that flows and reader is a technique where we read from that is a static data. I kno

4条回答
  •  青春惊慌失措
    2020-12-13 21:37

    As others have said, the use cases for each are slightly different (even though they often can be used interchangeably)

    Since readers are for reading characters, they are better when you are dealing with input that is of a textual nature (or data represented as characters). I say better because Readers (in the context of typical usage) are essentially streams with methods that easily facilitate reading character input.

提交回复
热议问题