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
Can we execute java program without main method?
Explain the difference between protected and default access.
Are static members inherited to sub classes?
Explain JMS in detail.
How do you override a method?
What is the purpose of checked and unchecked exceptions in JAVA?
What is the syntax and characteristics of a lambda expression?
If a method is declared as protected, where may the method be accessed?
How can we create a thread in java?
How to make a read-only class in java?
Can we write any code after throw statement?
What is compareto () in java?
What is the java idl system?
What is the meaning of course?
Can you access non static variable in static context?