sqlcode.java~1~
来自「用户的注册 用户的登陆 发布用户的相关信息 浏览网站介绍的其他酒店的」· JAVA~1~ 代码 · 共 51 行
JAVA~1~
51 行
package tool;
import java.util.Properties;
public class SQLCode {
private Properties sqlCodeProperties = new Properties();
SQLCode() {
load();
}
//取得sqlcode.properties中的sql语句
public String getSQLCode(String sqlKey) {
String sql = "";
if (sqlCodeProperties.containsKey(sqlKey)) {
sql = sqlCodeProperties.getProperty(sqlKey);
}
return sql;
}
/* public static SQLCode getInstance() {
return sqlCode;
}*/
//指向sqlcode.properties的位置
public void load() {
String fileName = "/rs/SQLCode.properties";
//通过指定路径找到资源文件存放在fileName中
sqlCodeProperties.clear();
//sqlCodeProperties清空
try {
java.io.InputStream in = null;
try {
in = getClass().getResourceAsStream(fileName);
//把fileName中存放值放入in字符流中
sqlCodeProperties.load(in);
} finally {
in.close();
}
} catch (java.io.IOException e) {
System.out.println(e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?