[Java] 纯文本查看 复制代码 public class Test11 {
public static void main(String[] args) throws IOException{
BufferedReader br =new BufferedReader(new FileReader("c.txt"));
int i =Integer.parseInt(br.readLine());
if(i>0){
System.out.println("还有"+i--+"次机会");
}else System.out.println("机会用完了");
BufferedWriter bw = new BufferedWriter(new FileWriter("c.txt"));
bw.write(String.valueOf(i));
br.close();
bw.close();
有的时候运行会跳到-1去,是为什么啊?
|