The code is below.
public interface DesignPatternInterface
{
int CUSTOMERAGE = 45;
}
public class ImplementInterface extends AbstaractDemo implements DesignPatternInterface
{
private static final int CUSTOMERAGE =20;
}
My question is interface variable is static final and memory will be assigned
My question is interface variable is static final
Yes. From section 9.3 of the JLS:
Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields.
Next:
and memory will be assigned
Not sure what you mean by this. It's just a static final field.
There is no relationship between DesignPatternInterface.CUSTOMERAGE
and ImplementInterface.CUSTOMERAGE
. They're entirely separate variables.
See more on this question at Stackoverflow