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
Why do we need data structure in java?
What is entry set in java?
Why volatile is used in java?
Can an unreferenced object be referenced again?
What is Classloader in Java?
Can you call a method in a method?
Which is dependent variable?
Why is an interface be able to extend more than one interface but a class can’t extend more than one class?
What is the synonym of string?
What is private protected in java?
What is the base class in java from which all classes are derived?
How will you calculate the depth of a binary tree if the tree contains 15 nodes?
why java does not support unsigned keyword?
Can java inner class be static?
Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?