Why do you not declare several variables of the same type on the same line?

后端 未结 16 2250
梦谈多话
梦谈多话 2020-12-06 05:41

Why is it bad practice to declare variables on one line?

e.g.

private String var1, var2, var3

instead of:

private          


        
16条回答
  •  误落风尘
    2020-12-06 05:45

    In my opinion, the main goal of having each variable on a separate line would be to facilitate the job of Version Control tools.

    If several variables are on the same line you risk having conflicts for unrelated modifications by different developers.

提交回复
热议问题