Skip to content

Instantly share code, notes, and snippets.

@ellbur
Created November 15, 2011 20:16
Show Gist options
  • Select an option

  • Save ellbur/1368194 to your computer and use it in GitHub Desktop.

Select an option

Save ellbur/1368194 to your computer and use it in GitHub Desktop.
Not overflowing the stack
public class Limited {
public static void main(String[] args) {
foo(0);
}
static int foo(int count) {
count = count + 1;
System.out.println(count);
if (count == 11000) {
return count;
}
else {
foo(count);
}
return count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment