I've tried finding an answer to this both online and in my own set of knowledge, but I cannot seem to find a definitive, clear answer.
Suppose I'm using only one class from another package only once which needs to be imported, say myPack.anotherPackage.ClassName
.
What is the difference, if any, between using an import statement:
import myPack.anotherPackage.ClassName;
versus using a fully qualified name:
myPack.anotherpackage.ClassName classInst = new myPack.anotherpackage.ClassName();
?
Obviously this question only applies if ClassName
is only used once.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…