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();
}
}
模拟Android软件试用到期提示注册
最新推荐文章于 2021-02-25 10:08:51 发布