您的位置:首页 > 移动开发 > Android开发

模拟Android软件试用到期提示注册

2015-11-07 17:55 423 查看
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();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: