This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maximum number of lines

 
Ravi Tanuku
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any limit on the maximum number of lines in a java class and a java method?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't think so. Why don't you write a really big method and find out?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic