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

what invokes a threads run() method? : Java thread

576


Why is string buffer better than string ?

605


What is the lifetime and scope of a variable?

520


How to compare strings in java?

508


What is indexof?

549






Is there is any difference between a scrollbar and a scrollpane?

565


How do you input a string in java?

505


What does java final mean?

522


Which is the class in java?

521


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

541


how to one war file class to another war file class?

1558


What is the disadvantage of synchronization?

567


What are design patterns and please explain?

576


How many techniques can be employed to create a string object?

561


What does the ‘static’ keyword mean? Is it possible to override private or static method in java?

568