
java
我是A_lin呀
勤于思,敏于行,善于言。
展开
-
格林威治时间转换
格林威治时间转换类型为 "Wed Oct 21 14:16:35 +0800 2020";对应掩码为 "EEE MMM dd HH:mm:ss Z yyyy";21/Oct/2020:14:16:35 +0800 类似这个格式的 // 线程不安全 Date format = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z" , new Locale("ENGLISH", "CHIN...原创 2020-10-21 18:31:16 · 1365 阅读 · 1 评论 -
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class xxx
使用java -cp xx.jar xxx类名 命令执行java程序报错:Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class com.guess.util.JdbcUtilsat com.guess.util.WordsUtils.truncateTable(WordsU...原创 2020-04-22 15:46:10 · 3620 阅读 · 0 评论 -
JDK1.7的try-with-resources 特性
资源类必须实现java.lang.AutoCloseable接口.采用JDK1.7的try-with-resources 特性,可以不用显式地去调用close命令;如果采用的是传统的try…catch写法,记得在finally {…}里面手动关闭资源,注意关闭的顺序./** * try-with-resources * @param file */ public stati...原创 2019-02-03 18:42:22 · 234 阅读 · 0 评论 -
天开始,天结束时间;周开始,周结束时间;月开始,月结束时间
/** * 一天的零时刻 * @throws ParseException */ public static Date getDayZero(Date date) throws ParseException{ //y----年,不要写Y了,否则用sdf.parse(timeStr)得到的时间意想不到 SimpleDateFormat sdf = new SimpleDat...原创 2019-02-27 23:14:38 · 193 阅读 · 0 评论