title: Close multiple resources with AutoCloseable (try-with-resources)
body: <p>I know that the resource you pass with a try, will be closed automatically if the resource has AutoCloseable implemented. So far so good. But what do I do when i have several resources that I want automatically closed. Example with sockets;</p>
  
  <pre><code>try (Socket socket = new Socket()) {
      input = new DataInputStream(socket.getInputStream());
      output = new DataOutputStream(socket.getOutputStream());
  } catch (IOException e) {
  } 
  </code></pre>
  
  <p>So I know the socket will be closed properly, because it's passed as a parameter in the try, but how should the input and output be closed properly?</p>