------- <a href="http://www.itheima.com" target="blank">android培训</a>、<a href="http://www.itheima.com" target="blank">java培训</a>、期待与您交流! ----------
需求:在D:下如果有一个info.txt配配文件,打开该文件看有没userName=zhangsan该项没在则增加该项,如果有userName且值不等于zhangsan则修改
如果没有info.txt则新建文件并添加userName=zhangsan该项。
代码如下
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;
public class PropettiesTest {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
File file = ne