Java类可以具有的最大字段数是多少? [英] What is the maximum number of fields a Java class can have?

查看:478
本文介绍了Java类可以具有的最大字段数是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java类或关联的对象实例可以具有的字段数是否有限制,如果可以的话,这是什么?

Is there a limit to the number of fields a java class or an associated object instance can have, and if so what is it?

我明确询问字段,而不是询问此问题的方法: 一个方法的最大数量是Java类可以拥有吗?

I am explicitly asking about fields, not methods as was asked in this question: What is the maximum number of methods a Java class can have?

推荐答案

在JVM规范中,它说:

In the JVM spec it says:

类或接口可以声明的字段数为 由ClassFile的fields_count项的大小限制为65535 结构(第4.1节)

The number of fields that may be declared by a class or interface is limited to 65535 by the size of the fields_count item of the ClassFile structure (§4.1)

这篇关于Java类可以具有的最大字段数是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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