📄 propertiesdemo.java
字号:
import java.util.*;
import java.io.*;
/**
* Demonstrates how to sort strings.
***/
public class PropertiesDemo
{
public static void main(String args[]) throws Exception
{
Properties props = new Properties();
props.put("db.user", "jack");
props.put("db.password", "opendoor");
// getProperty will return the value if found, otherwise null
System.out.println(props.getProperty("db.user"));
// getProperty will return the value if found, otherwise "none"
System.out.println(props.getProperty("db.password", "none"));
/*
// You can also load properties from a file
FileInputStream fis = new FileInputStream("my.properties");
props.load(fis);
fis.close();
**/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -