类 class [B 在 Java 中代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1466508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does the class class [B represents in Java?
提问by erotsppa
I am trying out a tool jhat here to test my java memory usage. It reads in a heap dump file and prints out information as html. However, the tables shows as follows:
我在这里试用了一个工具 jhat 来测试我的 java 内存使用情况。它读入堆转储文件并将信息打印为 html。但是,表格显示如下:
Class Instance Count Total Size
class [B 36585 49323821
class [Lcom.sun.mail.imap.IMAPMessage; 790 16254336
class [C 124512 12832896
class [I 23080 11923504
class [Ljava.lang.Object; 13614 6664528
class java.lang.String 108982 2179640
class java.lang.Integer 219502 878008
What are those [B [C etc classes?
那些 [B [C 等类?
采纳答案by Aaron Digulla
Those are arrays of primitives ([B == byte[]
, [C == char
, [I == int
). [Lx;
is an array of class type x
.
这些是基元数组 ( [B == byte[]
, [C == char
, [I == int
)。[Lx;
是一个类类型的数组x
。
For a full list:
完整列表:
[Z = boolean
[B = byte
[S = short
[I = int
[J = long
[F = float
[D = double
[C = char
[L = any non-primitives(Object)
Also see the Javadoc for Class.getName
.
另请参阅Class.getName
.
回答by Rob Di Marco
Looks like an array of characters (C)/bytes (B)/ints (I).
看起来像字符 (C)/字节 (B)/整数 (I) 的数组。