Properties isEmpty() in Java

isEmpty(): This method is available in java.util.Properties class of Java.

Syntax:

boolean java.util.Properties.isEmpty()

This method tests if this hashtable maps no keys to values.

Parameters: NA

Returns: true if this hashtable maps no keys to values; false otherwise.

Exceptions: NA

Approach

Java

import java.util.Properties;

public class PropertiesisEmpty {
    public static void main(String[] args) {

        Properties properties = new Properties();

        properties.put("Hello", "World");
        properties.put("C++", "Program");
        properties.put("Java", "Program");

        System.out.println(properties.isEmpty());
    }
}

Output:

false


No comments:

Post a Comment