Both the ways of importin classes are correct you can use both,but as you said you want only ResultSet class so the first option is better....
And now about the advantage of using a specific class from the package
like import java.sql.ResultSet;
If you use such it implies the user of your code that which specific classes from the package java.sql you have used in your code,the other user gets a easy understanding of your code bcoz if you import complete package ,if anyone jumps into your code wont understand which classes from the package you have utilised... and one more thing to say it shows your understanding as well
If you know that you are going to import only that particular class of that package then the first line is enough.Else you can use the second.Advantage is first line if you know the class that to be imported.Advantage Because its mere asking the JVM to search all the thing when you know the required.Thats it !!!
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Well as said above, Both the ways of importing classes are correct!
But to improve the readability of your code and not leave the user wondering for "How many other classes could Programmer have imported with that wild card character(*) other than the specific classname used?"
It will just tell the user directly that "Look i need to use this specific class and for that I'll have to Import this class only.Why go on adding its neighbours and relatives unnecessarily when you just need that one whole thing?"
As far as the compile time is concerned it makes no visible effect on it when you go for small applications but when you go for HUGE web applications it does take its toll on the compile time.
So the crux is if you are 128% sure which class you are going to need and use then go ahead with calling that class by xxx.xxx.classname else xxx.xxx.*
I just ran across a class with an ambiguous import error. There were two imports with stars that could lead to a class called X. On the first day this was written it was probably ok as X existed only in package 1. Then somebody added a new class X to package 2 and the code broke. Ouch! Don't use them stars.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com