[ACCEPTED]-Java implementation - Meta classes-metaclass
In Java there's a single metaclass: the 4 instances of the class Class
are used to represent 3 the types of classes and interfaces. The 2 constructors are defined at the class level, not 1 at the metaclass level.
Your question targets nothing special about 20 constructors: From the point of describing 19 classes on a metalevel there is the same 18 concept for constructors, "normal methods" and 17 fields.
So think of it this way:
Each class in 16 Java is described by a certain set of informations:
- Name of the class
- the superclass
- the implemented interfaces
- a list of constructors and their signatures
- a list of (static and non-static) methods and their signatures
- a list of (static and non-static) fields and their types
For 15 your convenience this information is available 14 to you during runtime - this is the "reflection 13 API".
Since the same type of information 12 is available for each class loaded by the 11 JVM, this is bundled in a own class named 10
java.lang.Class
.So one instance of the class
Class
describes the class 9java.lang.String
, another instance ofClass
describesmy.own.class.Foo
.java.lang.Class
itself is of 8 course also a class - therefore there also 7 exists an instance ofClass
describing the classClass
. And 6 I think that's where things get recursive 5 somehow.
Summary: There is only one metaclass: java.lang.Class
. Multiple 4 instances (meta-instance?) of the metaclass 3 describe individual classes - including 2 the metaclass itself. Constructor descriptions are part 1 of the instances of the metaclass.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.