What is the proper style for listing imports in Java?

前端 未结 10 1290
梦谈多话
梦谈多话 2021-02-18 16:01

Is it better to list each individual piece of a package you\'re going to need (see #1) or is it better to just import everything from a package (see #2)?

1



        
10条回答
  •  天命终不由人
    2021-02-18 16:19

    If you use an ide like visual studio it typically takes care of this issue for you, so you don't even need to bother thinking about it.

    Most IDEs that I am aware of choose option 1 above. This is consistent with some code analysis tools that I used in the past (like checkstyle), as they consider it bad practice to use the * notation.

提交回复
热议问题