What is the maximum number of methods a Java class can have?

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.

Leave a Comment