import java.util.*;
import java.io.*;
class PropertiesDemo
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
prop.setProperty("my.name","ABC xyz");
prop.setProperty("my.phone","3453545");
FileOutputStream fout=new FileOutputStream("Prop.properties");
prop.store(fout,"My Properties");
}catch(Exception e){}
}
}
******************************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo2
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
FileInputStream fin=new FileInputStream("Prop.properties");
prop.load(fin);
String name=prop.getProperty("my.name");
String phone=prop.getProperty("my.phone");
System.out.println("name="+name);
System.out.println("phone="+phone);
}catch(Exception e){}
}
}
/
name=ABC xyz
phone=3453545
*/
*********************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo3
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
prop.setProperty("my.name","ABC xyz");
prop.setProperty("my.phone","3453545");
FileOutputStream fout=new FileOutputStream("Prop.xml");
prop.storeToXML(fout,"My Properties");
}catch(Exception e){}
}
}
***************************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo4
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
FileInputStream fin=new FileInputStream("Prop.xml");
prop.loadFromXML(fin);
String name=prop.getProperty("my.name");
String phone=prop.getProperty("my.phone");
System.out.println("name="+name);
System.out.println("phone="+phone);
}catch(Exception e){}
}
}
/
name=ABC xyz
phone=3453545
*/
import java.io.*;
class PropertiesDemo
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
prop.setProperty("my.name","ABC xyz");
prop.setProperty("my.phone","3453545");
FileOutputStream fout=new FileOutputStream("Prop.properties");
prop.store(fout,"My Properties");
}catch(Exception e){}
}
}
******************************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo2
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
FileInputStream fin=new FileInputStream("Prop.properties");
prop.load(fin);
String name=prop.getProperty("my.name");
String phone=prop.getProperty("my.phone");
System.out.println("name="+name);
System.out.println("phone="+phone);
}catch(Exception e){}
}
}
/
name=ABC xyz
phone=3453545
*/
*********************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo3
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
prop.setProperty("my.name","ABC xyz");
prop.setProperty("my.phone","3453545");
FileOutputStream fout=new FileOutputStream("Prop.xml");
prop.storeToXML(fout,"My Properties");
}catch(Exception e){}
}
}
***************************************************************************
import java.util.*;
import java.io.*;
class PropertiesDemo4
{
public static void main(String ar[])
{
Properties prop=new Properties();
try{
FileInputStream fin=new FileInputStream("Prop.xml");
prop.loadFromXML(fin);
String name=prop.getProperty("my.name");
String phone=prop.getProperty("my.phone");
System.out.println("name="+name);
System.out.println("phone="+phone);
}catch(Exception e){}
}
}
/
name=ABC xyz
phone=3453545
*/
Comments