撰寫程式碼風格
對於class 有一個不成文規定:名稱第一個字母大寫,如有多個字母就併在一塊(不以底線連接), 每個字第一個字母大寫。
example : class AllTheColorsOfTheRainbow{}
method 、fields、 object reference 命名規則如上,唯一例外的是第一個字母小寫。
example: int anIntegetRepresentingColors;
JAVA提供兩種註解風格
1. /* 多行註解
多行註解
*/
2. // 單行註解
文件註解 Javadoc
/** 註解 */
example:
/** A class comment */
public class Document1{
/** A field comment */
public int i ;
/** A method comment */
public void f(){}
}
全站熱搜