8:06 am - Friday March 24, 2017

To Call the Hashtable method put using Properties.setProperty(String key, String value) method

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

This tutorial explains how to Load a property list from the input character stream using Properties.load(Reader reader) method.Properties setProperty(String key, String value) calls the Hashtable method put.


import java.util.Properties;

public class SetProperty

{

	public static void main(String[] args) throws Exception

	{

		Properties prop = new Properties();

		prop.setProperty("Chapter Count", "200");

		prop.put("Tutorial Count", "1500");

		prop.put("tutorial", "java2s.com");

		System.out.println(prop);

		prop.setProperty("Tutorial Count", "15");

		prop.setProperty("Chapter Count", "500");

		System.out.println(prop);

	}

}

Output

{Chapter Count=200, Tutorial Count=1500, tutorial=java2s.com}

{Chapter Count=500, Tutorial Count=15, tutorial=java2s.com}

BACK

Filed in: Java Examples

Comments are closed.