
java
qidaorenzhe
一介草民
展开
-
Thread,Thread.currentThread()和this
1,区别Thread.currentThread().sleep(2000);Thread.sleep(2000);本质上来讲, 其实是没有区别的,其功效完全一样。不过呢, 一些代码检查工具会认为 前者有点问题。前者其实是早期程序员的一个通用的写法, 无益也无害。 已经成为了一个不那么好的习俗了吧2,Thread.currentThread()与this的区别在线程的run 方...原创 2019-12-03 14:50:12 · 302 阅读 · 0 评论 -
java中try catch finally结构体的return问题
public static void main(String[] args) { System.out.println("结果:"+test());}public static int test(){ int i=0; try{ i=1;//1.1 System.out.println("try:"+i);//1.2 return i;//3.1 }catch...翻译 2019-11-05 15:00:28 · 180 阅读 · 0 评论 -
喜大苦奔!java不需要自己关闭io流了,就在jdk1.7
以往,我们需要在finally中关闭自己写的io流,防止内存溢出,相当麻烦。如下 InputStream is=null; InputStreamReader isr=null; BufferedReader read=null; try { is = new FileInputStream(new File("...原创 2019-11-05 15:08:37 · 1507 阅读 · 0 评论 -
log4j各项配置的含义
#cmsnew_displayboardlog4j.logger.com.linkage.module.cmsnew.displayboard=debug,displayboardlog4j.additivity.com.linkage.module.cmsnew.displayboard=falselog4j.appender.displayboard=org.apache.log4j.R...原创 2019-10-10 10:59:48 · 302 阅读 · 0 评论