⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertyconfig.java

📁 用java 实现的一个任务管理器
💻 JAVA
字号:
package com.fang.commom.util;

import java.io.InputStream;
import java.util.Properties;

public class PropertyConfig {

	public String getPara(String fileName,String key){
		
		Properties prop= new Properties();
		try {
		InputStream is = getClass().getResourceAsStream(fileName);
		prop.load(is);
		if(is!=null) is.close();
		}
		catch(Exception e) {
		System.out.println(e+"file "+fileName+" not found");
		}
		return prop.getProperty(key);
	}
	
	public void setPara(String fileName,String key,String value){
		Properties prop=new Properties();
		try {
			InputStream is = getClass().getResourceAsStream(fileName);
			prop.load(is);
			if(is!=null) is.close();
			}
			catch(Exception e) {
			System.out.println(e+"file "+fileName+" not found");
			}
			prop.setProperty(key, value);
		
	}
	
public static void main(String[] args) {
		
	   PropertyConfig test = new PropertyConfig();
	   System.out.println(test.getPara("db.property","serialNumtemp"));
	   
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -