From 3e1746487f91f433a5d9a4838a338a5025615cbb Mon Sep 17 00:00:00 2001 From: xiaochangbai <704566072@qq.com> Date: Thu, 24 Oct 2024 09:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=8E=82=E9=87=8C=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E9=80=92=E5=BD=92=E7=9A=84=E9=82=A3=E4=BA=9B=E5=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Java/ForeverTopJob.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Java/ForeverTopJob.java diff --git a/Java/ForeverTopJob.java b/Java/ForeverTopJob.java new file mode 100644 index 0000000..5e3dcb1 --- /dev/null +++ b/Java/ForeverTopJob.java @@ -0,0 +1,30 @@ +/** + * @BelongsProject: bullshit-codes + * @Author: xiaochangbai + * @CreateTime: 2024-10-24 09:29 + * @Description: TODO + * @Version: 1.0 + */ +public class ForeverTopJob { + + + public static void main(String[] args) { + + try { + recursiveFunction(10); + } catch (StackOverflowError e) { + e.printStackTrace(); + System.err.println("你发生栈溢出了噢\n赶紧去向领导报告这个问题吧,然后解决他,接着就喝着咖啡等着升职加薪了吧^_^..."); + } + } + + + // 一个永远不会停止的递归 + public static void recursiveFunction(int i) { + if (i == 0) { + return; + } else { + recursiveFunction(i--); // 使用后缀--,永远不会到达i==0 + } + } +} -- Gitee