Answer Posted / praveen kumar
The normal import declaration imports classes from packages, so that they can be used without package reference. Similarly the static import declaration imports static members from classes and allowing them to be used without class reference.
Now, we have got an excellent java feature from java 1.5. Ok now we shall see how we can abuse this!
Can i static import everything?
like, import static java.lang.Math.*; – yes it is allowed! Similarly you do for class import.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
When should a function throw an exception?
What is java lang string?
Is this valid in java ? Can we instantiate interface in java?
What is treeset and treemap in java?
What is a function argument in java?
What is the size of arraylist in java?
What class allows you to read objects directly from a stream?
What is the difference between stored procedure & function?
What is balanced tree in java?
In a container there are 5 components. I want to display the all the components names, how will you do that one?
Can we override the static method?
What is the difference between keyword and identifier?
What if static is removed from main method?
Can you make a constructor final in Java?
Can we override constructor in java?