[java beginners] ask questions about the closure of the stream?

when I read a book, I saw that there was something I didn"t understand. I"d like to ask. The
code is as follows:

clipboard.png
clipboard.png

the code in the figure:

try (FileInputStream in = new FileInputStream("./TestDir/build.txt");
    FileOutputStream out = new FileOutputStream("./TestDir/subDir/build.txt"))
The

book says that this paragraph is written in terms of automatic resource management, and there is no need to close the stream on its own. What does this mean?
We usually write code, but we don"t always end up with

.
in.close;
out.close;

close the stream?
Why is this place not closed?

Aug.27,2021

most of the early java code was written in this way:


AutoCloseable:

/**
 * An object that may hold resources (such as file or socket handles)
 * until it is closed. The {@link -sharpclose()} method of an {@code AutoCloseable}
 * object is called automatically when exiting a {@code
 * try}-with-resources block for which the object has been declared in
 * the resource specification header. This construction ensures prompt
 * release, avoiding resource exhaustion exceptions and errors that
 * may otherwise occur.
 *
 * @apiNote
 * 

It is possible, and in fact common, for a base class to * implement AutoCloseable even though not all of its subclasses or * instances will hold releasable resources. For code that must operate * in complete generality, or when it is known that the {@code AutoCloseable} * instance requires resource release, it is recommended to use {@code * try}-with-resources constructions. However, when using facilities such as * {@link java.util.stream.Stream} that support both I/O-based and * non-I/O-based forms, {@code try}-with-resources blocks are in * general unnecessary when using non-I/O-based forms. * * @author Josh Bloch * @since 1.7 */

FileInputStream and FileOutputStream implement the java.lang.AutoCloseable interface. Because they are both defined in the try-with-resource statement, this instance of FileInputStream and FileOutputStream will be closed regardless of whether the try code block completes normally or an exception occurs.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9788e-1665.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9788e-1665.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?