Do multiple import statements in a program affect performance?

后端 未结 4 2037
鱼传尺愫
鱼传尺愫 2021-02-14 14:51

I heard that using multiple import statements in a program affects its runtime performance. Is this true? If so, why?

相关标签:
4条回答
  • 2021-02-14 15:25

    If you use IDE's like Netbeans it can mark out duplicate imports in the editor, that way you can remove it from code to make it more maintainable and also reduce compiler warnings.

    0 讨论(0)
  • 2021-02-14 15:30

    Not at all. Imports are only used during compilation, the class files do not have them anymore.

    0 讨论(0)
  • 2021-02-14 15:42

    No, but importing more libraries than you need decreases the code readability.

    0 讨论(0)
  • 2021-02-14 15:45

    Another reason is if you have a multiple import statements, this may hide the class relationship from the reader. Sometime it's nice to know that certain class doesn't depend on (directly) to some certain other classes.

    0 讨论(0)
提交回复
热议问题