package com.javaniu;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
public class Main {
public static void main(String[] args) {
Properties property = new Properties();
try {
File file = new File("c:/db.properties");
if (!file.exists()) {
file.createNewFile();
}
// 写入
property.setProperty("database", "localhost");
property.setProperty("user", "javaniu");
property.setProperty("password", "password");
...
java读写Properties文件(未测试)
最新推荐文章于 2024-05-06 20:37:09 发布