public interface GroupedInterface extends Interface1, Interface2, Interface3 {
// constant declarations
// base of natural logarithms
double E = 2.718282;
// method signatures
void doSomething (int i, double x);
int doSomethingElse(String s);
}
(I’m studying from oracle’s site.This is from there.)It’s an interface definition and but we assign a number to E of type double. Is it possible all variables can declare x,y,z of type int and then assign some number to them (is it constant declaration or constant declaration is what? )?? Does E have special condition or etc. in the above code??
Variable declared in an interface are
staticandfinalby default, and are allowed. So you can set an initial value for the variables but not change them.