This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Maximum number of lines Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Maximum number of lines" Watch "Maximum number of lines" New topic
Author

Maximum number of lines

Ravi Tanuku
Greenhorn

Joined: Apr 06, 2005
Posts: 9
Is there any limit on the maximum number of lines in a java class and a java method?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Don't think so. Why don't you write a really big method and find out?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

I don't know if there is a theoretical limit, but if there is, it wouldn't be very interesting to know. There certainly isn't a practical limit.

In real life, you should never write classes that are so big that the compiler can't handle them - because if the compiler can't, then the programmer certainly can't.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41091
    
  44
There seems to be a limit of 64KB byte code within a method, which would also limit the amount of source code you can stuff into it. That's a feature of the JVM, so there's no way around it. There's a thread on this topic here.
[ September 05, 2005: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maximum number of lines
 
Similar Threads
Choice Group fit policy
Maximum number of lines in textarea
what does this Oracle error msg mean ?
max no of line in a java file
Code formatting