Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)
Someone explain to me what InputStream and OutputStream are?

I am confused about the use cases for both InputStream and OutputStream.

If you could also include a snippet of code to go along with your explanation, that would be great. Thanks!

1 Answer

0 votes
by (46k points)
edited by

The purpose of InputStream and OutputStream is to complex several approaches to input and output: whether that stream is a file, a web page, or the screen shouldn't imply. All that means is that you collect data from the stream (or send learning into that stream.)

InputStream is practiced for several things that you viewed from.

OutputStream is practiced for several things that you write to.

Are you interested in learning Java from the basics! Refer to this video on Java provided by Intellipaat:

Here's some example code. It considers the InputStream instr and OutputStream osstr have previously been performed:

int i;

while ((i = instr.read()) != -1) {

osstr.write(i);

}

instr.close();

osstr.close();

Related questions

0 votes
1 answer
asked Aug 29, 2019 in Java by Ritik (3.5k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...