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

后端 未结 16 2221
梦谈多话
梦谈多话 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条回答
  •  Happy的楠姐
    2020-12-06 05:53

    With separate lines, you have the opportunity to add a comment on each line describing the use of the variable (if it isn't clear from its name).

提交回复
热议问题