class="java" name="code"> public class RecursionTest { private static int num = 0; public static void main(String[] args) { testRecursion(); } public static void testRecursion(){ num++; System.out.println("执行第" + num + "次。"); if(num < 5){ testRecursion(); } else{ System.out.println("执行完毕。"); } } }