本帖最后由 toselect 于 2014-8-15 16:27 编辑
哪位大神帮我看看代码错在什么地方。。。count 为什么总是1?
- import java.io.*;
- import java.util.*;
- public 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);
- System.out.println(count);
- if(count>=5)
- System.out.println("次数已到,拿钱!");
- return;
- }
-
- count++;
-
- prop.setProperty("time",count+"");
-
- FileOutputStream fos=new FileOutputStream(file);
-
- prop.store(fos,"");
-
- fos.close();
- fis.close();
- }
- }
复制代码
|
|