I have been looking into the java class file format. I have specifically been looking into creating classes from byte-code. I have been able to find most of the info that i need from the oracle documentation, and other Google searches. However I haven't been able to find out how and where constructors are stored in the class file. I thought they might be stored in the method table but i am not sure, and if they are i would like a specification of how they are stored.
From the JVM specification, section 2.9:
At the level of the Java Virtual Machine, every constructor written in the Java programming language (JLS §8.8) appears as an instance initialization method that has the special name
<init>
. This name is supplied by a compiler. Because the name<init>
is not a valid identifier, it cannot be used directly in a program written in the Java programming language.
Additionally:
A class or interface has at most one class or interface initialization method and is initialized (§5.5) by invoking that method. The initialization method of a class or interface has the special name
<clinit>
, takes no arguments, and is void (§4.3.3).