Created
April 24, 2014 20:48
-
-
Save bchetty/11268991 to your computer and use it in GitHub Desktop.
Java - Recursion Depth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** | |
* Inception | |
* | |
* @author Babji, Chetty | |
*/ | |
public class Inception { | |
public static void main(String[] args) { | |
Inception inception = new Inception(); | |
inception.dream(0); | |
} | |
public void dream(long count) { | |
try { | |
dream(count + 1); //Dream inside a Dream | |
} catch (StackOverflowError SOF) { | |
System.out.print("Recursion Depth : " + count); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment