Content received from: http://JavaFAQ.nu/java-article60.html


Question: Quite often I see that programmers use full name of class in a program
Tuesday, February 18, 2003 (00:00:00)

Posted by jalex

Question: Quite often I see that programmers use full name of class in a program. For example like this:

java.util.Vector vect = new Vector();

I do not like such long lines, they are not so nice! Is not it easier to use the "import" in the beginning of program:

import java.util.*;

and then: Vector vect = new Vector(); ?

Answer: By using full class name in a program a programmer avoids names collision situation - a case when you could have your own Vector class in your package:



com.mypack.utilities.*

For example you have:

import com.mypack.utilities.*;
import java.util.*;

Compiler will not understand which Vector class you reffer in the line below:

Vector vect = new Vector();
The usage of full class name makes the situation clear.
***************************************
Our older tips: March 22, 2001 - Oktober 21, 2002 read here.
All published and not published on site tips you can find here