Javatpoint Logo
Javatpoint Logo

Java ByteArrayOutputStream close() method

The close() method of Java ByteArrayOutputStream class closes this output stream and releases any system resource linked with this stream. The stream which has been closed cannot perform output operations and cannot be reopened.

Syntax:

Specified By:

close() method in interface Autocloseable.

close() method in interface Closeable.

Throws:

IOException - if an I/O error occurs

Example 1

Test it Now

Output:

AB@C

Example 2

Test it Now

Output:

KLMN






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA