Static Members of Interface in Java | Java Training Online

This Java Training Online “Static Members of Interface in Java” is providing information about how to define and access static members in interface including static main method.


Can we define main method inside interface ?

  • It is allowed since jdk 1.8.


  • We can define static methods and can access directly using interface identity.
  • Abstraction is applicable for non static members(methods).
  • Static members cannot be overridden because it is common functionality of Object.
  • We cannot update static members in the hierarchy.
  • If we want to update, we should modify in the top class of hierarchy.


Can we define instance variables inside Interface?

  • Not allowed.
  • Non static variables belongs to object – but we cannot create object of interface.
  • Non static variables must be initialized through constructor – but we cannot define.
  • All the interface variables are ‘public static final’ by default.


We can check as follows….

Share this