Code example for Properties

Methods: load, setProperty, store

0
 * 
 * @author Steve 
 */ 
public class DBProperties { 
 
    private static final Properties prop = new Properties();
 
    static { 
        try { 
            prop.load(new FileInputStream("database.properties"));
        } catch (IOException ex) {
            prop.setProperty("dbUrl", "jdbc:mysql://localhost/quintex");
            prop.setProperty("dbUser", "quintex");
            prop.setProperty("dbPassword", "quintex123");
            try { 
                prop.store(new FileOutputStream("database.properties"), "Database Properties");
            } catch (IOException ex1) {
                Logger.getLogger(DBProperties.class.getName()).log(Level.SEVERE, null, ex1);
            } 
        } 
    }