Java Properties get property name list

Description

Java Properties get property name list

import java.util.Enumeration;
import java.util.Properties;

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

    Properties prop = new Properties();

    prop.setProperty("CSS", "style");
    prop.setProperty("HTML", "tag");
    prop.setProperty("Java", "backend");
    prop.setProperty("Javascript", "frontend");

    Enumeration<String> e = (Enumeration<String>)prop.propertyNames();

    for (; e.hasMoreElements();) {
      System.out.println(e.nextElement());

    }// w w  w .  java  2 s. c  o  m
    
  }
}



PreviousNext

Related