Interface Class in Java

This question may be a little off topic, but I cannot understand why there is no class in Java Interface.

Each class has its own object java.lang.Classbuilt by the JVM. And, of course, interfaces should not fall into objects Classas well java.lang.Interface. That would make sense, right?

I know that this class assignment function exists, so that a class that implements an interface can be added to this interface, but is it better to name it Typeinstead Class? Then stretch Typeto create Classand Interface.

I know for sure that Java developers will not do anything, but I'm just curious.

+4
source share
1 answer

, . Class , , . Type, , . , AnonymousClass. , getEnclosingConstructor() .

, # Type.

, , , . , Java 1.0 , Class .class.

+2

Source: https://habr.com/ru/post/1547269/


All Articles