Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of static import ?

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


Please Help Members By Posting Answers For Below Questions

Difference between java and javascript

1151


How many types of variables are there?

1175


Can a static block throw exception?

1138


Can a class declared as private be accessed outside it’s package?

1061


What is a functional interface?

1091


Compare Mutex and Semaphore in java.

1051


What is an 8 bit word?

1098


What does sprintf mean?

1000


What is the purpose of default constructor?

1035


What is a substring of a string?

1230


What is integer parseint?

1052


What is final keyword in java?

1069


Why runnable interface is used in java?

1192


Is array dynamic in java?

989


Are strings immutable in java?

1025