Would it be considered worsening the future readability of the code if I used them throughout the code? For example using:
import static java.lang.Integer.*;
so I can use this code
int a = parseInt(scanner.nextLine());
when should you use static import? Very sparingly! Only use it when you'd otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern)
For your case Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually.
Link for more detail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With