Eclipse 更改代码格式

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