JAVA中类的引用大小 [英] Size of reference of an class in JAVA

查看:50
本文介绍了JAVA中类的引用大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中类的引用大小是多少?对于特定的JVM和OS,它是否不变,而与引用所针对的类无关.

What is the size of reference of a class in Java? Is it constant for a particular JVM and OS irrespective of the class for which the reference is made.

Class A
Class B
Class C


A a;
B b;
C c;

a b c 的大小是否相同,而与 A B C 类?

Are the size of a, b and c the same irrespective of the size of A, B and C classes?

推荐答案

是的,所有引用都是对象的指针"或对象的间接指针".它们的实际内存大小是JVM的实现细节,但是您可以确保它们在不同类中的大小相等.

Yes, all references are "pointers" to Objects or indirect "pointers to pointers" to Objects. Their actual in memory size is an implementation detail of the JVM but you can be sure that they are equal in size for different classes.

这篇关于JAVA中类的引用大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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