Properties entrySet() in Java

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

Syntax:

Set<Entry<Object, Object>> java.util.Properties.entrySet()

This method returns a Set view of the mappings contained in this map.

Parameters: NA

Returns: a set view of the mappings contained in this map.

Exceptions: NA

Approach

Java

import java.util.Properties;

public class PropertiesentrySet {
    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.entrySet());
    }
}

Output:

java.util.Properties$EntrySet@2401f4c3


No comments:

Post a Comment