I read that interfaces have no constructors, which means that he will not call super () his superclass. I also read that every class in Java is a subclassObject
Object
What about an interface, is it a subclass of Object? Why?
No no. An interface cannot be created to create an object; it is not a class.
No interface is a subclass of the Object class, because an interface cannot extend a class, implicit or explicit.
, , - , , , .
( ). .
, . , , , .
interface Interface{ abstract String fun(); } Interface interfc=new Interface() { @Override public String fun() { return super.toString(); } }; Type type=interfc.getClass();
. java language. super, .
super
An anonymous class cannot have an explicitly declared constructor.
, .
"can-do", "is-a", , " __er" " __able". , ( ), , , , - " " ". - :" ", . , - :" ? " " ", " ", , ," " " ". " " " ".
Java. , . , , , ; -: ", - ", , . , "". , , , , , . , "", .
An interface cannot have a constructor. Because the interface supports multiple inheritance. This means that if a class inherits two interfaces, then there will be ambiguity due to the constructor chain, the constructor of which will be called from the constructor of the class.