user.ini
DBuser=rampukar
DBpassword=mos
DBlocation=db_java
readIni.java
import java.util.*;
import java.io.*;
class readIni {
public static void main(String args[]) {
readIni ini = new readIni();
ini.doit();
}
public void doit() {
try{
Properties p = new Properties();
p.load(new FileInputStream("user.ini"));
System.out.println("user = " + p.getProperty("DBuser"));
System.out.println("password = " + p.getProperty("DBpassword"));
System.out.println("location = " + p.getProperty("DBlocation"));
p.list(System.out);
}
catch (Exception e) {
System.out.println(e);
}
}
}
Folder Structure :
Output
0 comments:
Post a Comment