Properties prop = new Properties(); prop.put("database.url", "jdbc:mysql://localhost:3306/mydb");
Properties prop = new Properties(); prop.put("username", "JohnDoe"); prop.put("password", "secretpassword"); String username = prop.getProperty("username"); String password = prop.getProperty("password");In this example, we are creating a new Properties object and then using the put() method to add two new key-value pairs for a username and password. We then use the getProperty() method to retrieve the values of these keys and store them in variables for later use. The java.util.Properties package is part of the Java Standard Library, which means it is available in all Java applications by default and does not require any additional external libraries or packages to be imported or installed.