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
What are different types of states exist for a thread?
What is the purpose of a parameter?
Why is string buffer better than string ?
What is final variable?
What is array and arraylist in java?
What is a byte array?
Is nullpointerexception checked or unchecked?
What is the use of accept () method in java?
What do you understand by private, protected and public?
What is downcasting?
Why is a singleton bad?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
What does n mean in java?
Which one will take more memory: an int or integer?
What is the maximum size of hashmap in java?