以加载连接数据库驱动为例:
jdbc.properties配置文件放到src文件夹下,内容如下:
driverClass = com.mysql.jdbc.Driver
url = jdbc:mysql://localhost:3306/day16
username = root
password = 12s004020
注意字符串后面没有“;”
工具类部分代码如下:
private static final String DRIVERCLASS;
private static final String URL;private static final String PASSWORD;
private static final String USERNAME;