java 新手的問題

2012-10-17 1:07 am
1. \t 和\r 如何用?

2. javax.swing.* 中,swing代表咩?

3. java.util.* 中,util 代表咩?

4. System.exit() 有何用?()中的integer 代表咩?

5. 咩叫inner class?

6. 在showMessageDialog 中,不要特別icon 但係想用title bar,可吾可以只寫(null,"_____","____")?

7. public static void main (String args []) 中,args[] 已經可以用來儲string,為何要用Scanner?

THX~

回答 (2)

2012-10-17 3:40 am
✔ 最佳答案
1. 用下就知
2. swing中譯搖擺,但程式上係冇意思,你只需要知道點用
3. util冇中譯,但英文就有工具意思,等同java只不過係名稱,真正意思係咖啡
4. 試用就知,寫程式係要試
5. inner class係一個class中之class
6. 試用就知,冇人唔俾你試
7, args係一個argument,當你執行程式時需要加上一個數值或字串,叫做parameter,例如println("hello world")

2012-10-17 1:57 pm
\t = tab in text eg. system.out.println("love"+"\t"+"you"); //spacing of text
display = love you something like that :D
\r = carriage return e.g like you press enter on text...

javax.swing.* = from lib. of javax inside have many lib. -_- and get swing class and * stand for any lib in javax.swing that was used. (swing class mostly use in drawing etc.)

util = configuration, tools, that helps us from programming, such as requirement of HashMap,Tree and Arrays
System.exit() = exit of the whole program, integer inside shows the status of the exit (emergency exit?/ exit in friendly way?)

JOptionPane.showMessageDialog(null,"_____","_____",JOptionPane.PLAIN_MESSAGE, null); //use constant

Scanner = is to help with analysis text in nice Token way,compare to bufferedReader which goes by each character/line, so if you have number and String together like "x 2", scan.nextInt() are use to get number even if string were there at front


收錄日期: 2021-04-13 19:03:07
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20121016000051KK00262

檢視 Wayback Machine 備份