软件试用次数

it2022-05-05  95

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(); } }

 

转载于:https://www.cnblogs.com/lovedaydream/p/5116381.html


最新回复(0)