my dog learned polymorphism*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 14278
    
  21

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 8 API documentation
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42356
    
  64
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