What is the maximum number of methods a Java class can have?
I am thinking to build a VERY large Java class, is there any limit on the number of methods the Java class can have? Can it go into the millions of methods?
update: The purpose is, yes, to make a "God" class.
According to the Java class file specification the limit is 65535:
4.10 Limitations of the Java Virtual Machine
The following limitations of the Java virtual machine are implicit in the class file format:
- The number of methods that may be declared by a class or interface is limited to 65535 by the size of the methods_count item of the ClassFile structure (§4.1). Note that the value of the methods_count item of the ClassFile structure does not include methods that are inherited from superclasses or superinterfaces.