title: Try-with-Resources Android Studio
body: <p>I have a project that have a "Project language level" = 6.0. I try to change this to 7.0 but this not changes, I believe that is because I selected the "Minimum required SDK" as API 10 and if I want to change it I need to choose as API 19. This is the code that needs to use "Language level" equals to 7.0</p>
  
  <pre><code>    URL url= new URL(strURL);
      HttpURLConnection connection = (HttpURLConnection) url
              .openConnection();
  
      connection.setRequestProperty("Content-Type",
              "application/json; charset=utf-8");
      connection.setDoOutput(true);
      connection.setRequestMethod("POST");
  
      try (OutputStreamWriter out = new OutputStreamWriter(
              connection.getOutputStream(), "UTF-8")) {
          out.write(requestContent.toString());
      }
  
      StringBuilder responseBuilder = new StringBuilder();
  
      try (BufferedReader in = new BufferedReader(new InputStreamReader(
              connection.getInputStream(), "UTF-8"))) {
          String buffer;
          while ((buffer = in.readLine()) != null) {
              responseBuilder.append(buffer);
          }
      }
  
      return new JSONObject(responseBuilder.toString());
  </code></pre>