摘要:
1.用正则表达式分割字符串
Pattern SPLIT2 = Pattern.compile("[,]");
String[] tmpStrings1 = SPLIT2.split(string); 阅读全文
摘要:
推荐还是用第一种方法,即用timer并且在timer里面使用线程池。
1.timer中用线程池来执行任务,可以保证开始执行时间的准确,具体结束时间要以任务需要执行时间为准。如果未使用线程池,执行时间将被任务执行时间所影响。
package timer;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask; 阅读全文