When I observe my Java project byte code, I see the following byte code :
java.lang.Object.()V
java.lang.Boolean.(Z)V
What is the meaning of <init>()V and <init>(Z)V
java.lang.Object.()V
is a void method (V
) on java.lang.Object
that takes no arguments.
java.lang.Boolean.(Z)V
is a void method on java.lang.Boolean
that takes a single boolean
(Z
since B
is byte
) argument.
In short,
abc.def.WXYZ(IIIIIIIIIIIIII)J
^ ^ ^
target_class argument-types return_type
See JNI Type Signatures for more detail.
The JNI uses the Java VM’s representation of type signatures. Table 3-2 shows these type signatures.
Table 3-2 Java VM Type Signatures
Type Signature Java Type Z boolean B byte ... L fully-qualified-class ; fully-qualified-class [ type type[] ( arg-types ) ret-type method type
For example, the Java method:
long f (int n, String s, int[] arr);
has the following type signature:
(ILjava/lang/String;[I)J
It's all method signatures in bytecode used by JVM.
<init>()V and <init>(Z)V
are construtor signatures. For JVM constructors are just as any other methods, they have a name, which is always <init>
), and a return value, which is always V
(means void). In our case Z
means boolean
parameter (B
is reserved for byte
)
that is
<init>(Z)V
in class Test's bytecode means
class Test {
Test(boolean arg0) {
}
}
you can also meet
static <clinit>()V
which means static initialization block
static {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With