import java.util.*; public class Example { public static void main(String[] args) { Properties prop = new Properties(); prop.setProperty("username", "john"); prop.setProperty("password", "password123"); //... } }
import java.util.*; import java.io.*; public class Example { public static void main(String[] args) { Properties prop = new Properties(); try (InputStream input = new FileInputStream("myFile.properties")) { prop.load(input); } catch (IOException ex) { ex.printStackTrace(); } //... } }In this example, we create a new Properties object and load the properties from a file called "myFile.properties" using the `load` method. Overall, the java.util Properties package is used for handling property files and configurations settings within Java applications.