utf-8格式
window->preference->General->workspace 下將Text file encoding
設(shè)置為UTF-8格式绵载,New text file line dlimit
設(shè)置為unix
同時(shí)preference->web->jsp flies 下將 Encoding也設(shè)置為UTF-8 默認(rèn)jsp文件已UTF-8格式
使用空格來(lái)代替tabs
將空格用 ·
代替顯示
preference->General->Text Editors 下勾上show whitespace characters
同時(shí)勾上Insert spaces for tabs
設(shè)置tab代替的空格為四個(gè)
preference->java->code style->formatter 下新建一個(gè) 同時(shí)edit 將Indentation標(biāo)簽下的Tab policy
改為Space only
保存自動(dòng)刪除尾部空行
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 條件括號(hào)后要有空格
- try catch final 后面都要有空格
- 函數(shù)參數(shù)逗號(hào)后要有空格画侣,后括號(hào)與之前要有空格隔開秸仙。
- = 总放,+號(hào)前后都有空格
- sql關(guān)鍵詞全部大寫
- 其他java語(yǔ)法代碼細(xì)則基本一致丑掺,注意空格