A single-type-import declaration imports a single named type, by mentioning its canonical name. A type-import-on-demand declaration imports all the accessible types of a named type or package as needed.
I want to know : if I only use Vectorin package java.util,but I write instead of ,then will I pay more time on compiling and running the code?
hi, In run time you don't need to worry, because it will not consume extra time because of importing all the content of package. But ofcouse at the time of compile time it will (But very negliable amount of time). But i suggest import only that file which is need by your code. It is good programming practice. -arun
Sharing is learning
Joined: Dec 27, 2001
many thanks to arun boraiah again, is this only a programming practice? which document can I find the specification about this? [ February 05, 2002: Message edited by: stone eniac ]
Joined: Nov 28, 2001
hi, I mentioned "good programing practice" because of following reasons 1. you will be sure that if in case more then one class have same name placed in different package which is beeing imported. 2. By importing content of a package all by name. Helps to keep track of all class you are using. Ofcouse also i feel i have read about using import with class name importing is good progrmming practice. But i don't remember where. -arun