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...


Why we should declare the variables as static and final in
interfaces?



Why we should declare the variables as static and final in interfaces?..

Answer / nc

It is automatic static and final even if you don't declare it.
Why? Because when a class implements these interfaces, these
variables must be able to be accessed by static and
non-static methods. Also as these variables are specific to
any class instances(i.e. at the same time many classes can
implement these interfaces), they must have the same value
across the implementing classes.
Also if you want to load the value of certain values at the
application start up and all implementing classes wants
these values unchanged, then these must be static and final.
So they are static and final.

Is This Answer Correct ?    15 Yes 1 No

Post New Answer

More Core Java Interview Questions

Is it safe to install java on my computer?

0 Answers  


How does JAVA ClassLoader work?

1 Answers   IBM,


What is purpose of keyword void?

0 Answers  


what us Dyna action form?

4 Answers   Aithent Technologies,


What is the benefit of lambda expressions?

0 Answers  


Difference between Web-based applications,Client- Server applications and Distributed applications?

3 Answers   Infosys,


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

0 Answers  


How dead lock situation occurs in java and how you can identify it?

0 Answers  


What is an object in java?

0 Answers  


where lives in jvm

5 Answers  


What is the Vector class?

3 Answers  


If a class is declared without any access modifiers, where may the class be accessed in java programming?

0 Answers  


Categories