22. 问:怎样计算代码执行所花费的时间? 答: 代码开始取时间,结束后取时间,相减 long t1 = System.currentTimeMillis(); ///////////////// your code long t2 = System.currentTimeMillis() ; long time = t2-t1;
23. 问:如何获在程序中获得一个文件的ContentType? 答: URL u = new URL("file:///aaa.txt"); URLConnection UC = u.openConnection(); String s = uc.getContentType();
34. 问:对于JFrame,hide(),show()与setVisibel()有什么区别吗? 答: setVisible()从Component继续过来,而hide(),show()从Window里面继续过来。 Makes the Window visible. If the Window and/or its owner are not yet displa yable, both are made displayable. The Window will be validated prior to being made visible. If t he Window is already visible, this will bring the Window to the front. 区别在这。