interface variables

interface variables

why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why it is final by default?

thanks in advance..
View Answers

May 17, 2010 at 1:21 PM

Hi Friend,

The final modifier ensures the value assigned to the interface variable is a true constant that cannot be re-assigned by program code.If they are not defined as final,class implementations can change value of fields. Then they would become a part of the implementation. An interface is a pure specification without any implementation, hence they are final to prevent accidental modifications.

Thanks









Related Tutorials/Questions & Answers:
interface variables - Java Beginners
interface variables  why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why it is final by default? thanks in advance
interface variables - Java Beginners
interface variables  why interface variable is by default final? what was the necessisity to make it final? plz explain me with good java prog
Advertisements
interface variables - Java Interview Questions
interface variables  why interface variables are final? explain me... modifier ensures the value assigned to the interface variable is a true constant... of the implementation. An interface is a pure specification without any
Variables
Variables  What are the difference between Static variables, instance variables and local variables
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use of the methods(functions) and variables within it. In java, multiple inheritance
Interface
) and variables within it. Here is an example where we have defined an interface... for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract
interface
interface   what is the use of marking interface
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  why do we need interface in java..if it`s usefull for to obtain multiple inheritance in the sense how it gonna be achieved...and i can...)...the y we need interface...THis is question often i heard from my developer
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  Declare an Interface called property containting a method compute price to compute &return the price.The inerface is to be implemented by follwaing two class (1)Bungalow&(2)Flat both the lasses have following
getting variables
getting variables   how to get variables from servlet program to webservice program
Environment variables
Environment variables  How to set Environment Variables in JAVA 6 n Tomcat 6 CLASSPATH, JAVA_HOME, PATH, & CATALINA variables plzzz plzz help me
Java - Declaring variables in for loops
Java - Declaring variables in for loops  Java - Declaring variables in for loops
Abstract and Interface
-final variables. 3)Members of a Java interface are public by default. A Java...Abstract and Interface  What is interface? When time is most suitable for using interface? Why we use interface instead of abstract? What
instance variables - Java Beginners
instance variables  instance variables
Variables In Java
This tutorial demonstrates you about the variables and their types in java
transient variables in java
transient variables in java  hello, What are transient variables in java?   hii,ADS_TO_REPLACE_1 Transient variables are variable that cannot be serialized
Java Substituting Variables
Java Substituting Variables  Java Substituting Variables
Variables in Java
Variables       Data... variables)ADS_TO_REPLACE_1 Java Primitive Data Types Data Type... variables. A variable refers to the memory location that holds values like: numbers
Static & Instance variables in java
Static & Instance variables in java  What are the Difference between Static & Instance variables in java
Marker Interface,Java Marker Interface
Interface in Java       In this section we will learn about Interface and Marker Interfaces in Java. This tutorial will clarify you questions "What is marker Interface?"
What are local variables?
What are local variables?   hi, What are local variables? thanks... a block of syntax like methods. Local variables should be initialised before accessing them. For details related to Local Variables
What are instance variables?
What are instance variables?   Hi, What are instance variables... for these non-static variables so we can say that these are related to objects (instances of the class).Hence these variables are also known as instance variables
What is an interface?
What is an interface?  What is an interface
What is JavaScript Variables ?
What is JavaScript Variables ?  Hi, My question is that What is Variable in JavaScript Programming Language. How to declare variables in JavaScript Program. Thanks, (adsbygoogle = window.adsbygoogle || []).push
Can an Interface implement another Interface?
Can an Interface implement another Interface?   Hi, Can an Interface implement another Interface? Thanks
Can an Interface extend another Interface?
Can an Interface extend another Interface?   Hi, Can an Interface extend another Interface? thanks
Variables in Smarty
Variables in Smarty Templates Engine for PHP Smarty Template variables... file variablesADS_TO_REPLACE_2 Smarty Variables can be declared as: {$new..._TO_REPLACE_13 You can use smarty associative array variables as well as indexed arrays
session variables server side
session variables server side  how to hold session variable for server side..?   request.getSession().setAttribute("wellSelection", uid
ServletRequest interface
ServletRequest interface   What is new in ServletRequest interface
JavaScript Variables
JavaScript Variables: Variables are like containers, which contains a value. In JavaScript variables dependent on the value, not on the datatype that means variables are of  dynamic typing. Variable names are case-sensitive
java protected variables
java protected variables   Can we inherit the Java Protected variable..?   of course you can. But I think what you mean is "override"? Is tha so? There are some restriction
Interface and Abstract class
methods that implements a default behavior. 2)Variables declared in a Java interface...Interface and Abstract class  Difference between Interface and Abstract class? Give some example   Difference Between Interface
Java Variables - Java Beginners
Java Variables  Hi, I had a small doubt. What are Object Reference variables in java..What actually they do.. And What actually an Object... reference variables, and how can i see what a reference variable contains.. shape
Java Variables - Java Beginners
Java Variables  Hi, I had a small doubt. What are Object Reference variables in java..What actually they do.. And What actually an Object... reference variables, and how can i see what a reference variable contains.. shape
Map interface
Map interface  What is the Map interface
Java interface
Java interface  What is the List interface
List interface
List interface  What is the List interface
Interface implimentation
Interface implimentation  How to impliment an interface For Achieveing MVC & loosCupling in Any Project

Ads