config.java

来自「一个农场」· Java 代码 · 共 18 行

JAVA
18
字号
package cn.edu.hunnu.factory;
import java.util.Properties;
import java.io.*;
public class Config{
       private static Properties p;//store the relationship of product and factory
	
       public static void  init(){
        try{
          File f=new File("config.properties");//construct a file from config.properties 
          FileInputStream fs=new FileInputStream(f);
          p=new Properties();
          p.load(fs);//load the  relationship of product and factory from f
          fs.close();
        }catch(Exception e){
        	System.out.println(e.getMessage());
        }
       }
    }

⌨️ 快捷键说明

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