title: Unable to read properties file after creating it
body: <p>I am creating a properties file and putting into my classpath folder Resources.
  When I tried to read this file , i am not getting the expected result. i am getting the result of the previous values printed instead of the property values set now.
  My class file is as follows :</p>
  
  <pre><code>public class App {
    public static void main(String[] args) {
  
      Properties prop = new Properties();
      PrintWriter output = null;
  
      try {
  
          output = new PrintWriter("Resources/config.properties");
  
          // set the properties value
          prop.setProperty("database", "localhost");
          prop.setProperty("dbuser", "mkyong");
          prop.setProperty("dbpassword", "password");
  
          // save properties to project root folder
          prop.store(output, null);
          if(output!=null) {
              System.out.println("Output");
  
              output.close();
  
          }
  
      } catch (IOException io) {
          io.printStackTrace();
      } finally {
          if (output != null) {
  
                  output.close();
  
          }
  
      }
  
      Properties prop1 = new Properties();
      BufferedInputStream input = null;
  
      try {
  
          String filename = "config.properties";
          input =  (BufferedInputStream) AppCPLoad.class.getClassLoader().getResourceAsStream(filename);
          if(input==null){
                  System.out.println("Sorry, unable to find " + filename);
              return;
          }
  
          //load a properties file from class path, inside static method
  
          prop1.load(input);
  
              //get the property value and print it out
              System.out.println(prop1.getProperty("database"));
              System.out.println(prop1.getProperty("dbuser"));
              System.out.println(prop1.getProperty("dbpassword"));
              if(input!=null) {
                  System.out.println("Input");
                  input.close();
              }
      } catch (IOException ex) {
          ex.printStackTrace();
      } finally{
          if(input!=null){
              try {
              input.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
          }
      }
    }
  }
  </code></pre>
  
  <p>Please help. </p>