Complete the code to load a properties file in Java.
Properties prop = new Properties(); FileInputStream fis = new FileInputStream("config.properties"); prop.[1](fis);
The load method reads the properties file into the Properties object.
Complete the code to get the value of a property named 'url'.
String url = prop.[1]("url");
The getProperty method retrieves the value for the given key from the Properties object.
Fix the error in the code to properly close the FileInputStream.
FileInputStream fis = new FileInputStream("config.properties"); try { prop.load(fis); } finally { fis.[1](); }
The close method properly releases the resource held by FileInputStream.
Fill both blanks to create a Properties object and load the file safely using try-with-resources.
try (FileInputStream fis = new FileInputStream("config.properties")) { Properties [1] = new Properties(); [2].load(fis); }
Using the same variable name prop for the Properties object is clear and consistent.
Fill all three blanks to read a property 'browser' and print it.
Properties prop = new Properties(); try (FileInputStream [1] = new FileInputStream("config.properties")) { prop.load([1]); String browser = prop.[2]("browser"); System.out.println("Browser: " + [3]); }
The FileInputStream variable is fis, the method to get property is getProperty, and the variable to print is browser.