How do I modify Eclipse code formatting?

后端 未结 5 739
醉酒成梦
醉酒成梦 2020-12-01 09:30

When I reformat code with Eclipse, it turns method headers like this:

public void myMethod(String param) {

into method headers like this:

5条回答
  •  鱼传尺愫
    2020-12-01 10:07

    The best way to change your format is to go to Window-> Preferences-> Java-> Code Style-> Formatter. Inside the formatter window, eclipse has a couple of built in styles, but the best way is create a new profile of your own by pressing on New. You can change the format as you please on the edit tab

    As shown in the image

    You can change parentheses and curly braces positioning along with other stuff.

提交回复
热议问题