How do you create a loop without actually spawning a loop? Somebody in AP Java Programming managed to pull it off. (Bear with me -- this happened awhile ago and I can't remember the full code, though this was the specific line of code.)
- Code: Select all
public class FrankLoop() {
FrootLoop * new FrankLoop();
}
For those that don't understand the code, this will just keep spawning more FrankLoop()s.
Simple, no? Frank called in Eric, the Java-programming wiz-kid, to figure out why his program kept stalling. Eric looked over the code a few times, and eventually found the randomly-inserted FrankLoop() class. His reaction was even funnier than the existence of the code:
Eric wrote:YOU'VE CREATED AN INFINITE LOOP! IT WILL JUST KEEP GOING AND GOING AND GOING UNTIL IT RUNS OUT OF MEMORY!... let's try running it on someone's Web server!
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 Donzilla/1.1PR1 (WML/1.3)

