在资源文件夹中创建文件test.properties
内容为name=over
读取改文件
public class Test2 { public static void main(String[] args) throws IOException { Properties p = new Properties(); p.load(Test2.class.getClassLoader().getResourceAsStream("test.properties")); System.out.println(p.get("name")); } }
over