Can an interface hold any instance variables?

By default interface variables will always be public static final whether you mention these modifiers or not while defining variables. So, you can never have an instance variable in an interface.


variables declared in interface are by default public, static and final. Since it is static you cannot call it instance variable.


  • Variables which declared in interface are by default public, static and final.

  • These are static so you cannot call it as instance variable.


Variables declared in an interface are by default public, static and final by default. So you can use interfaces to define constants.

You can read more about this Here

enter image description here

Tags:

Java