Properties size() in Java

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

Syntax:

int java.util.Properties.size()

This method returns the number of keys in this hashtable.

Parameters: NA

Returns: the number of keys in this hashtable.

Exceptions: NA

Approach

Java

import java.util.Properties;

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

Output:

3


No comments:

Post a Comment