public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("aaa.txt")); 创建流对象关联aaa.txt,aaa.txt上记录剩余次数
String line = br.readLine();
int times = Integer.parseInt(line);
if(times > 0) {
FileWriter fw = new FileWriter("aaa.txt");
fw.write(--times + "");
System.out.println("您还有" + times + "次机会");
fw.close();
}else {
System.out.println("您的试用次数已到,请购买正版");
}
br.close();
}
|