stringPropertyNames(): This method is available in java.util.Properties class of Java.
Syntax:
Set<String> java.util.Properties.stringPropertyNames()
This method returns an unmodifiable set of keys from this property list where the key and its corresponding value are strings.
Parameters: NA
Returns: an unmodifiable set of keys in this property list where the key and its corresponding value are strings, including the keys in the default property list.
Exceptions: NA
Approach
Java
import java.util.Properties;public class PropertiesstringPropertyNames {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.stringPropertyNames());}}
Output:
[Java, C++, Hello]
No comments:
Post a Comment