Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////////////////////////////
- // StackOverflow.java
- // ==================
- // testing stack size of JVM
- //
- // AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
- // CREATED: 2010-11-01
- // UPDATED: 2010-11-01
- ///////////////////////////////////////////////////////////////////////////////
- public class StackOverflow // declare class
- {
- public static int count = 0; // declare & initialize variable count
- public static void main(String[] args)
- {
- try
- {
- foo();
- }
- catch(StackOverflowError e)
- {
- System.out.println("StackOverflowError at " + count);
- //e.printStackTrace();
- }
- } // close main method
- public static void foo() // create method foo()
- {
- ++count;
- foo();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement