Do unused imports in java effects performance and consume memory? [duplicate]
Asked Answered
A

1

6
import java.io.*;
class Myclass
{
 //Some programming code that does not call any java io package methods or variables
}

Is that program takes more memory or even worse affect performance of the software/app than the program that has no unused imports?

Anemometry answered 15/6, 2015 at 13:44 Comment(4)
No. They just may the compiler work harder! With or without the unused import has no effect on the produced class file, which then has no effect on the runtime performance.Jupiter
See also here.Inexpressible
Does that means it effects performance?Please elaborate.Anemometry
Also duplicate of this: #18154190Shoal
C
3

No, imports are a compile-time feature (they have no meaning in the compiled code). They do not affect runtime behavior.

Changchangaris answered 15/6, 2015 at 13:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.