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 / sreedhar a

As per interface definition all the member variables by
default are public static final. There is no difference
between I and j variables. JVM will consider the j variable
as public static final int j=0;
Note: variables declared in interface must be initialized
otherwise program will fail to compile.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is multiple inheritance not supported in java?

557


Tell us something about set interface.

555


What are the differences between the constructors and methods?

571


Which java version is latest?

534


Why do we need wrapper classes?

568






What is void keyword?

664


Why are the destructors for base class and derived class called in reverse order when the program exits

1701


What is a byte string?

615


What is the difference between logical data independence and physical data independence?

530


What is synchronization and why is it important in java programming?

469


Is set ordered?

535


What is a newline character in java?

563


Can you use this() and super() both in a constructor?

520


What is main string [] args?

518


Explain method local inner classes ?

587