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

is it mandatory to deaclare all variables public static
fianl in interfaces?if i declare like in the below program,
public interface A
{
public static final int I=0;
int j=0;
}
in interface A,what is the difference between I,j?

Answer Posted / ramakrishna

generally if we want to access the variables(non-static)
which are present in the class we use the reference of that
class. we get the reference of the class after creation of
the object. but we can not able to create the object of the
interface if we define the non-static variables inside the
interface if we want to access it is not possible so if we
want to define the variables we should have to define the
variables as static.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we call a non-static method from inside a static method?

998


What is the significance of listiterator?

1101


How to do a true java ping from windows?

1158


Does substring create a new object?

1001


What is the inheritance?

975


What is difference between arraylist and list in java?

1094


What is a function in java?

1036


Why set do not allow duplicates in java?

1105


How many types of equations are there?

1020


How to convert string to byte array and vice versa?

1090


What is the difference between JDBC 1.0 and JDBC 2.0?

3189


What is a methodologist?

1071


What is the difference between member variables initialization and assignment in a constructor?

1281


What is port number in java?

1045


Why Java is not pure Object Oriented language?

1113