utf-8格式
window->preference->General->workspace 下將Text file encoding設(shè)置為UTF-8格式,New text file line dlimit 設(shè)置為unix
同時preference->web->jsp flies 下將 Encoding也設(shè)置為UTF-8 默認(rèn)jsp文件已UTF-8格式
使用空格來代替tabs
將空格用 · 代替顯示
preference->General->Text Editors 下勾上show whitespace characters
同時勾上Insert spaces for tabs 設(shè)置tab代替的空格為四個
preference->java->code style->formatter 下新建一個 同時edit 將Indentation標(biāo)簽下的Tab policy改為Space only
保存自動刪除尾部空行
preference->java->Editor->save actions 下勾上Perform the selected actions on save Additional actions 之后點(diǎn)擊configure ,在Code Organizing 標(biāo)簽下勾上 Remove trailing whitespace
代碼細(xì)則
- if 后面要有空格 if 條件括號后要有空格
- try catch final 后面都要有空格
- 函數(shù)參數(shù)逗號后要有空格,后括號與之前要有空格隔開。
- = ,+號前后都有空格
- sql關(guān)鍵詞全部大寫
- 其他java語法代碼細(xì)則基本一致,注意空格