Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java golf: StackOverflowError

 
Bartender
Posts: 2230
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Task:
Write a Java program that will throw StackOverflowError when executed with source code as short as possible.
 
Ranch Hand
Posts: 529
19
Eclipse IDE MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rancher
Posts: 3571
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... I just came across this. I guess the idea of code golf is not well known - too bad. For Java, I think the minimum length would be:
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is using the exception/error itself equally good?

 
Paweł Baczyński
Bartender
Posts: 2230
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mike Simmons wrote:For Java, I think the minimum length would be:



It could be shorter
A hint

K. Tsang wrote:Is using the exception/error itself equally good?


Of course it is allowed. Although, the solution is longer.
 
Mike Simmons
Rancher
Posts: 3571
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I see. Three characters less - nice.

 
    Bookmark Topic Watch Topic
  • New Topic