打開eclipse
選擇 window-->Preferences-->JAVA-->Code-->Code Style-->Formatter--> 右邊點(diǎn)Import 選擇JAVA編碼規(guī)范_格式化模板.xml(點(diǎn)擊即可下載)文件導(dǎo)入進(jìn)去即可

使用方法:
使用快捷鍵ctrl+Shift+F或者source->Format。
> 另附eclipse添加注釋模板的方法
選擇 window-->Preferences-->JAVA-->Code-->Code Style→Code Template--> 右邊點(diǎn)Import 選擇JAVA編碼規(guī)范_注釋模板.xml(點(diǎn)擊即可下載)文件導(dǎo)入進(jìn)去即可(注意把xml中的author換成自己的名字)


使用方法:
將鼠標(biāo)光標(biāo)移動(dòng)到類型、方法、屬性等上,使用快捷鍵alt+Shift+J。
