2

In my program i have to use sort function of the Collections class. Is that compile time remains same in both the cases?

  • Case 1: include import java.util.Collections;
  • Case 2: import java.util.*;

What I thought is that the second case is gonna take long time to search for the Collections class, if there are other import packages.

Please correct me if am wrong.

meskobalazs
  • 15,741
  • 2
  • 40
  • 63

1 Answers1

2

Imports are only used to resolve class names, this is done before compilation. The overhead of searching whole packages should be negligible.

meskobalazs
  • 15,741
  • 2
  • 40
  • 63