Properties values() in Java

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

Syntax:

Collection<Object> java.util.Properties.values()

This method returns a Collection view of the values contained in this map.

Parameters: NA

Returns: a collection view of the values contained in this map.

Exceptions: NA

Approach

Java

import java.util.Properties;

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

Output:

[Program, Program, World]


No comments:

Post a Comment