GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing www.tutorialspoint.com — Java Properties Class
Selected Reading
Java Properties ClassIntroductionThe Java Properties class is a class which represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Following are the important points about Properties −
Class declarationFollowing is the declaration for java.util.Properties class − public class Properties extends Hashtable<Object,Object> FieldFollowing are the fields for java.util.Properties class − protected Properties defaults − This is the property list that contains default values for any keys not found in this property list. Class constructors
Class methods
Methods inheritedThis class inherits methods from the following classes −
Getting an Enumeration of Properties Keys ExampleThe following example shows the usage of java.util.Properties.propertyNames() method. package com.tutorialspoint;
import java.util.Enumeration;
import java.util.Properties;
public class PropertiesDemo {
public static void main(String[] args) {
Properties prop = new Properties();
// add some properties
prop.put("Height", "200");
prop.put("Width", "15");
// assign the property names in a enumaration
Enumeration<?> enumeration = prop.propertyNames();
// print the enumaration elements
while(enumeration.hasMoreElements()) {
System.out.println("" + enumeration.nextElement());
}
}
}
OutputLet us compile and run the above program, this will produce the following result − Width Height Advertisements
| ||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |