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

wht is customised exception?

1 Answers   Logica CMG, Novell, Prudential,


What is the difference between preemptive scheduling and time slicing in java programming?

0 Answers  


What are null interfaces? Give some examples?

2 Answers  


Why does it take so much time to access an applet having swing components the first time?

0 Answers  


how to convert Java project into Maven ?

0 Answers   Infosys,


What modifiers may be used with an inner class that is a member of an outer class in java programming?

0 Answers  


we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PROGRAM FOLLOWS OOPS CONCEPTS i.e, Inheritance,Polymarphism,Encapsulation? class a{ public static void main(String args[]){ System.out.println("Hello World"); } }

3 Answers  


Can we pass null as argument in java?

0 Answers  


Difference between arraylist and vector.

0 Answers  


types of applets?.

7 Answers   TCS,


What is the difference between a factory and abstract factory pattern?

0 Answers  


What is the difference between a local variable and an instance variable?

0 Answers  


Categories