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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Is 0 a prime number?

992


Can a method be static?

971


Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?

989


What is the size of boolean variable?

1079


List some features of the abstract class.

1071


These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }

1088


What is the abstraction?

1022


What is the purpose of garbage collection in java, and when is it used?

1043


How do you sing an Applet ?

2462


What does || || mean in math?

941


What is defined as false sharing in the context of multithreading?

1045


What is indexof?

988


What do you mean by constant time complexity?

1251


Explain the features of java?

1016


What is immutable data?

1061