有人能给我解释一下这个程序吗?
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
class abc {
private Properties settings;
abc() throws IOException {
try {
settings = new Properties();
settings.load(new FileInputStream("c:\\count.txt"));
} catch (FileNotFoundException e) {
settings.store(new FileOutputStream("c:\\count.txt"),("this program is used:"));
}
}
private String computerName;
private String ip;
private String dbName;
private String user;
private String pw;
public String getPropertyValue(String propertyName) {
return settings.getProperty(propertyName);
}
public void setPropertyValue(String propertyName, String propertyValue)
throws FileNotFoundException, IOException {
settings.put(propertyName, propertyValue);
settings.store(new FileOutputStream("c:\\count.txt"),
("this program is used:"));
}
public void setComputerName(String computerName)
throws FileNotFoundException, IOException {
setPropertyValue("computerName", computerName);
this.computerName = computerName;
}
public String getComputerName() {
return computerName;
}
void setIp(String ip) throws FileNotFoundException, IOException {
setPropertyValue("ip", ip);
this.ip = ip;
}
String getIp() {
return ip;
}
void setDbName(String dbName) throws FileNotFoundException, IOException {
setPropertyValue("dbname", dbName);
this.dbName = dbName;
}
String getDbName() {
return dbName;
}
void setUser(String user) throws FileNotFoundException, IOException {
setPropertyValue("user", user);
this.user = user;
}
String getUser() {
return user;
}
void setPw(String pw) throws FileNotFoundException, IOException {
setPropertyValue("pw", pw);
this.pw = pw;
}
String getPw() {
return pw;
}
public static void main(String[] args) throws FileNotFoundException,
IOException {
abc xyz = new abc();
xyz.setComputerName("Admin");
System.out.println(xyz.getComputerName());
xyz.setIp("192.168.0.1");
System.out.println(xyz.getIp());
xyz.setDbName("mydbname_firstdb");
System.out.println(xyz.getDbName());
xyz.setUser("myusername");
System.out.println(xyz.getUser());
xyz.setPw("mypassword");
System.out.println(xyz.getPw());
}
}