随笔分类 -  Java基础

摘要:package util;public class Pub { public static void beforeSort(int[] arr){ System.out.println("before sort: "); for(int i:arr){ System.out.print(i... 阅读全文
posted @ 2015-05-31 21:57 IamThat 阅读(971) 评论(0) 推荐(0)
摘要:newFixedThreadPool创建一个固定大小的线程池。shutdown():用于关闭启动线程,如果不调用该语句,jvm不会关闭。awaitTermination():用于等待子线程结束,再继续执行下面的代码。该例中我设置一直等着子线程结束。 Java代码 收藏代码public class... 阅读全文
posted @ 2015-03-16 10:12 IamThat 阅读(342) 评论(0) 推荐(0)
摘要:import java.util.concurrent.TimeUnit; 2 3 public class TimeUnitDemo { 4 private TimeUnit timeUnit =TimeUnit.DAYS; 5 6 public static void mai... 阅读全文
posted @ 2015-03-16 08:09 IamThat 阅读(704) 评论(0) 推荐(0)
摘要:最佳的休眠方法为TimeUnit.MILLISECONDS.sleep(100); Thread.sleep()….. 阅读全文
posted @ 2013-06-04 11:38 IamThat 阅读(794) 评论(0) 推荐(0)
摘要:/** * 批量处理方法 * Makes all Compontens the same Size * * @param comps */ public static void makeSameSize(JComponent... comps) { if (comps.length == 0... 阅读全文
posted @ 2013-06-04 09:19 IamThat 阅读(412) 评论(0) 推荐(0)
摘要:Desktop.getDesktop().browse(new URI(http://www.baidu.com/)); 调用本地默认浏览器打开网页 Desktop.getDesktop().browse(new File("D:\\all").toURI());打开该D:\\all所在文件目录 打开本地文件另一种方法: Desktop.getDesktop().open(new File(... 阅读全文
posted @ 2013-06-03 17:12 IamThat 阅读(1023) 评论(1) 推荐(0)
摘要:private void setMyLookAndFeel() { try { UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); Font font = new Font("Dialog", Font.PLAIN, 12); UIMa... 阅读全文
posted @ 2013-06-03 14:22 IamThat 阅读(2671) 评论(0) 推荐(0)
摘要:前者用户线程中动态加载,动态加载资源 后者只是固定的加载 http://bbs.csdn.net/topics/370181498 如果楼主了解过openfire应该对ClassLoader有比较深的理解。 打个简单的比方,你一个WEB程序,发布到Tomcat里面运行。 首先是执行Tomcat org.apache.catalina.startup.Bootstrap类,这时候的类... 阅读全文
posted @ 2013-06-02 14:19 IamThat 阅读(486) 评论(0) 推荐(0)