开发者

How is a Java object constructed?

开发者 https://www.devze.com 2023-02-19 03:49 出处:网络
If I create a class like: public class Test{ int id; String name; } Now, i开发者_运维问答f I have to use the class, we have to just create a instance of the class as

If I create a class like:

public class Test{
       int id;
       String name;
}

Now, i开发者_运维问答f I have to use the class, we have to just create a instance of the class as

Test testObj = new Test();

I would like to know how the actual object is created in the system. (In core level, what will be the structure of the object.)


This depends on the actual virtual machine (vendor, version). There's no detailed specification on how a VM should store the instance.

The Java virtual machine does not mandate any particular internal structure for objects.

0

精彩评论

暂无评论...
验证码 换一张
取 消