Skip to content

Instantly share code, notes, and snippets.

@ktul
ktul / TryWithResources.java
Created December 13, 2021 14:53
Try-with-resources example and an equivalent old-style implementation
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Collectors;
class TryWithResources {
public static void main(String[] args) {
System.out.println("with resources:");
withResource();