+8

static structure

Is there a difference in the static structure in interface and class?

2/9/2019 8:30:58 PM

Challenge Me

4 Answers

New Answer

+14

⏹️ You can't define static methods in an interface bcoz, static methods were belonging to "class " not to an " instance of class, and interfaces are not Classes.

+3

Writing an interface is similar to writing a class. But a class describes the attributes and behaviors of an object. And an interface contains behaviors that a class implements

+2

Tejas Gupta thanx I know the difference between class and interface but my question is that is there a difference between the static method in interface and class in the meta-space?

+2

Shruthi thanx but we can define a static method in the interface since Java 8 (eke default method)