字节代码之间的差异。< init>()V vs。< init>(Z)V [英] Difference between byte code .<init>()V vs .<init>(Z)V

查看:137
本文介绍了字节代码之间的差异。< 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


这篇关于字节代码之间的差异。&lt; init&gt;()V vs。&lt; init&gt;(Z)V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆