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. 區別在這。