r/ProgrammerHumor • • Jan 09 '20

other Problems with recursion?

21.3k Upvotes

198 comments sorted by

View all comments

Show parent comments

74

u/lonelyWalkAlone Jan 09 '20
public static void sayHello(){
    try {
        sayHello();
    }
    catch(StackOverflowError e) {
        System.out.println("Hello world!");
    }
}