0

When we import classes in another class, is this going to increase the size of the java file in which we are importing the other classes. What kind of performance difference it causes?

What is the performance difference if I import:

import java.util.*; 

or a specific class import:

import java.util.arraylist;
Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
Avinash Solanki
  • 1,091
  • 1
  • 10
  • 19

1 Answers1

2

It does not change anything at all. The import statements are just there to help the compiler create the necessary bytecode; in the bytecode itself, all class references are fully qualified and linkage is done at runtime, always (this is what a classloader is all about).

Now, depending on coding styles, "star imports" may be frowned upon...

fge
  • 119,121
  • 33
  • 254
  • 329