获取.propertys文件获取文件内容

导入包

import java.io.BufferedInputStream;

import java.io.FileInputStream;

import java.io.InputStream;

import java.util.Properties;



String path = this.getClass().getResource("/").getPath();

InputStream in = new BufferedInputStream(new FileInputStream(path+name));

Properties p = new Properties();

p.load(in);

通过p.getProperty("Statistic")就能获取文件中名字为Statistic的内容

.propertys中视力为:

Statistic=用户

Statisticmes=提醒



你可能感兴趣的:(java)