Sobes.tech
Junior — Senior

Determining the sequence of close() calls in a try-with-resources block

livecode

Task condition

It is necessary to determine the order in which the close() method will be called for resources declared in a try-with-resources statement. Consider the following code example and specify the closing order:

try (R1 a = ...; R2 b = ...; R3 c = ...) {
    ...
}