Properties Test In Java Collection Program
In this Example, we will discuss an important chapter of Java, Properties test but Before we can start to make the Properties Test Program, click on the Advertisements , available on this page.
import java.util.*;
class Propertiestest
{
public static void main(String args[])
{
Properties defList = new Properties();
defList.put("Florida", "Tallahassee");
defList.put("Wisconsin", "Madison");
Properties capitals = new Properties(defList);
Set states;
String str;
capitals.put("Illinois", "Springfield");
capitals.put("Missouri", "Jefferson City");
capitals.put("Washington", "Olympia");
capitals.put("California", "Sacramento");
capitals.put("Indiana", "Indianapolis");
states = capitals.keySet();
Iterator itr = states.iterator();
while(itr.hasNext()) {
str = (String) itr.next();
System.out.println("The capital of " +str + " is "+capitals.getProperty(str)+ ".");
}
System.out.println();
// Florida will now be found in the default list.
str = capitals.getProperty("Florida");
System.out.println("The capital of Florida is "+ str + ".");
}
}
Compile And Run On This Program for Better Understanding....
If this information is important to you , and you want to , I will continue writing some more details of Java, Android Programming Language, so click on the advertising, available on this page. This is motivate me for writing some more useful stuff, Thank's
Comments
Post a Comment