properties配置文件(练习)
来源:互联网 发布:mt4软件手机版 编辑:程序博客网 时间:2024/06/01 07:39
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
class Demo{
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
File file = new File("F:\\a.properties");
if(!file.exists()) {
file.createNewFile();
}
properties.load(new FileInputStream(file));
int count = 0;
String value = properties.getProperty("count");
if(value!=null)
count = Integer.parseInt(value);
if(count == 3) {
System.out.println("已经使用了三次, 请购买正版");
System.exit(0);
}count++;
System.out.println("您已经使用了"+count+"次");
properties.setProperty("count", count+"");
properties.store(new FileOutputStream("F:\\a.properties"), "haha");
}
}
阅读全文
0 0
- properties配置文件(练习)
- java Io 配置文件Properties练习
- Properties(配置文件类)
- Properties(配置文件类)
- Properties(配置文件类)
- Properties配置文件(计数器)
- JAVA之旅(二十九)——文件递归,File结束练习,Properties,Properties存取配置文件,load,Properties的小练习
- 日常练习,SequenceInputStream合并文件以及Properties配置文件加载
- hibernate 配置文件(hibernate.properties)
- Jav读取配置文件(Properties)
- log4j 配置文件 (XML/.properties)
- log4j配置文件(.properties)详解
- java读取配置文件(Properties)
- java读取配置文件(.properties)
- Properties配置文件
- Properties配置文件
- Properties配置文件
- properties配置文件
- SSL_2324 细胞问题
- 二分优化的暴力枚举
- 如果你不了解机器学习的简史,请看这篇文章
- 乐虎功能饮料颠覆行业格局,能否实现销量奇迹?
- handler机制的原理
- properties配置文件(练习)
- JSON的那些事儿(你真的了解JSON吗)
- facebook 抓取用户的公共帖子
- 开启某个Mysql数据库远程访问
- windows下编译最新版ffmpeg3.3-android,并通过CMake方式移植到Android studio2.3中
- 工作中用到的mysql
- powerdesign 设置表字符集和存储引擎 与主键自增设置
- 安徽科技学院Contest1116
- 卸载MyEclipse2015在线安装版的SVN插件