软件试用次数

import java.io.*;
import java.util.*;
class RunCount 
{
    public static void main (String[] args)throws IOException
    {
        Properties prop = new Properties();
        File file = new File("count.ini");
        if(!file.exists())
            file.createNewFile();
        FileInputStream fis = new FileInputStream(file);
        prop.load(fis);
        
        int count = 0;
        String value = prop.getProperty("time");
        if(value!=null){
            count = Integer.parseInt(value);
            if(count>=5)
            {
                System.out.println("你好,请注册后使用!");
                return;
            }
            count++;
            }
        prop.setProperty("time",count+"");
        FileOutputStream fos = new FileOutputStream(file);
        prop.store(fos,"");
        
        fis.close();
        fos.close();
    }
}

 

posted @ 2016-01-09 14:28  lovedaydream  阅读(276)  评论(0编辑  收藏  举报