Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 7
    \$\begingroup\$ Functional, complies with the rules, golfed. Wondering why it was downvoted. \$\endgroup\$ Commented Nov 11, 2013 at 15:03
  • 14
    \$\begingroup\$ Does java forbid the classic for(;;) pattern? What about while(true)? \$\endgroup\$ Commented Nov 21, 2013 at 13:38
  • 21
    \$\begingroup\$ @CodesInChaos, Java doesn't normally disallow those patterns and normally I would consider them cleaner and more idiomatic. Here though we are trying to sneak an infinite loop past the compiler (those forms cause the compiler to complain about the static {} block not exiting). \$\endgroup\$ Commented Nov 21, 2013 at 17:56
  • 2
    \$\begingroup\$ @Mechanicalsnail Yes, static blocks can't execute alone since java 7. \$\endgroup\$ Commented Feb 4, 2014 at 14:51
  • 1
    \$\begingroup\$ @OliverNi But you can't use the static block. \$\endgroup\$ Commented Sep 1, 2017 at 15:17