📌  相关文章
📜  java.lang.StackOverflowError - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:27.236000             🧑  作者: Mango

代码示例3
public class StackOverflowErrorExample {

  public static void recursivePrint(int num) {
    System.out.println("Number: " + num);
    if (num == 0)
      return;
    else
      recursivePrint(++num);
  }

    public static void main(String[] args) {
      StackOverflowErrorExample.recursivePrint(1);
    }
}