字节代码之间的差异。< init>()V vs。< init>(Z)V [英] Difference between byte code .<init>()V vs .<init>(Z)V
问题描述
当我观察我的Java项目字节代码时,我看到以下字节代码:
When I observe my Java project byte code, I see the following byte code :
java.lang.Object。()V
java.lang.Boolean。(Z)V
什么是含义< init>()V 和< init>(Z)V
推荐答案
java.lang.Object.()V
是 java.lang上的void方法(
。 V
)。没有参数的对象
is a void method (V
) on java.lang.Object
that takes no arguments.
java.lang.Boolean.(Z)V
是<$ c $的无效方法c> java.lang.Boolean 接受一个布尔
( Z
,因为 B
是 byte
)参数。
is a void method on java.lang.Boolean
that takes a single boolean
(Z
since B
is byte
) argument.
简而言之,
abc.def.WXYZ(IIIIIIIIIIIIII)J
^ ^ ^
target_class argument-types return_type
参见 JNI类型签名了解更多详情。
JNI使用Java VM的签名类型的表示。表3-2显示了这些类型签名。
The JNI uses the Java VM’s representation of type signatures. Table 3-2 shows these type signatures.
表3-2 Java VM类型签名
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
例如,Java方法:
long f (int n, String s, int[] arr);
具有以下类型签名:
(ILjava/lang/String;[I)J
这篇关于字节代码之间的差异。< init>()V vs。< init>(Z)V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!