1. 进入Eclipse,选择Window -> Preference;
  2. 选择Java -> Code Style -> Formatter,点击Active profile中的Edit…;
    Eclipse 更改代码格式
  3. 进入到如下窗口后,进行你想要的修改。修改完后点击Apply;Eclipse 更改代码格式
  4. 回到之前的窗口,点击Apply和Apply and Close;
  5. 选择Source -> Format,然后你的代码就自动更改为你想要的格式了。

相关文章: