Deepak said:
Can anybody please let me know what is the maximum size of a JAVA class
file?
Practically unlimited, if you're talking about the possibility of
swelling a class file with useless garbage. Even if you want to
restrict yourself to class files that a real, general-purpose java
compiler might produce, the upper limit is still pretty high: hundreds
of megabytes, certainly; possibly as much as about two gigabytes.
What is the maximum number of methods in a JAVA class?
See the JVM spec:
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88659
That doesn't tell the whole story, because the various constraints are
not independant. For instance, although there is room in the method
table for 65536 methods, each one requires a minimum of two entries in
the runtime constant pool, in which there are only 65535 positions
available. On the other hand, that limit doesn't apply to methods
inherited from superclasses. Each method (of any class) that you invoke
in your class' code requires a total of six (if I've counted them
correctly) entries in the constant pool, although some of these could be
shared with other method invocations.
John Bollinger
(e-mail address removed)