import java .io.*;
import java.util.*;
class Properties3
{
public static void main(String[] args) throws IOException
{
File f=new File("ddd.txt");
Properties prop=new Properties();
if (!f.exists())
f.createNewFile();
FileInputStream fis=new FileInputStream(f);
prop.load(fis);
String value=prop.getProperty("time");
int count=0;
if (value!=null)
{
count=Integer.parseInt(value);
if (count>5)
{
System.out.println("该付钱了");
}
}
count++;
prop.setProperty("time",count+"");
FileOutputStream fos=new FileOutputStream(f);
prop.store(fos,"hah");
fis.close();
fos.close();
}
}
|
|