import java.io.*;
import java.util.*;
class  RunCount
{
	public static void main(String[] args) throws IOException
	{
		Properties pro = new Properties();
		File file = new File("Count.ini");//创建Count.ini配置文件
		if(!file.exists())//
			file.createNewFile();

		FileInputStream fis = new FileInputStream(file);//输入流
		pro.load(fis);//从输入流中读取

		int count = 0;
		String value = pro.getProperty("time");//指定time记录次数属性
		if(value!=null)
		{
			count = Integer.parseInt(value);
			if(count>5)
			{
				System.out.println("您好,试用次数已到,请充值继续使用");
				return;
			}
		}
		count++;
		pro.setProperty("time",count+"");//再次计入
		FileOutputStream fos = new FileOutputStream(file);//输出流
		pro.store(fos,"");//写入到输出流

		fos.close();
		fis.close();
	}
}

posted on 2015-11-07 17:55  超宇  阅读(148)  评论(0)    收藏  举报