Connecting Tech Pros Worldwide Forums | Help | Site Map

static member variables in interface

dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#1: Apr 17 '07
i have a little bit confusion on interface and static members variables in it.
having static member variables in interface and non-static member variables...........what is the difference?

plz help.

regards.

Member
 
Join Date: Apr 2007
Posts: 41
#2: Apr 19 '07

re: static member variables in interface


Quote:

Originally Posted by dmjpro

i have a little bit confusion on interface and static members variables in it.
having static member variables in interface and non-static member variables...........what is the difference?

plz help.

regards.

In Interface while declaring the variables, if you are not mentioned static,
by default it will be treated as static variable, you are unable to declare the non-static variables in Interface, not only that if you declare a variable in Interface by not mentioning the static or non-static it will be treated as public static final which means a Constant, reason being we are unable to create an Object for an Interface, so to use the Variables of an Interface , the variables must be Static
dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#3: Apr 20 '07

re: static member variables in interface


fantastic .... it was in my mind

i just waiting for a perfect answer.

anyway thanx.
Reply