fx计算器

master
xzj 12 months ago
commit 254554f962

@ -0,0 +1,34 @@
package java7131;
import java.io.InputStream;
import java.util.Properties;
public class Profile7131 {
public static void main(String[] args) {
Properties properties = new Properties();
try (InputStream input = Profile7131.class.getResourceAsStream("myProFile7131.properties")) {
// 注意这里假设myProFile7131.properties文件位于资源目录的根下
if (input == null) {
System.out.println("Sorry, unable to find myProFile7131.properties");
return;
}
properties.load(input);
} catch (Exception ex) {
ex.printStackTrace();
return; // 可以在捕获异常后直接返回,避免后续代码执行
}
// 获取并输出属性值
String id = properties.getProperty("id");
String name = properties.getProperty("name");
String sex = properties.getProperty("sex");
String age = properties.getProperty("age");
System.out.println("ID: " + id);
System.out.println("Name: " + name);
System.out.println("Sex: " + sex);
System.out.println("Age: " + age);
}
}

@ -0,0 +1,4 @@
id=212207131
name=\u8C22\u5B50\u5EFA
sex=\u7537
age=20
Loading…
Cancel
Save