在C#,C ++和Java中引起栈溢出的最简单的方法 [英] Simplest ways to cause stack overflow in C#, C++ and Java
本文介绍了在C#,C ++和Java中引起栈溢出的最简单的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在看一个C#教程,遇到了StackOverflowException。
I'm watching a C# tutorial and came across StackOverflowException.
叙述者使用下面的代码片段给出了一个这样的异常的一个整洁的例子,
the narrator gave a neat example of such an exception using the code snippet below,
public class Employee
{
private string _name;
public string Name
{
get{ return Name; }
}
}
我在寻找这种类型的一些例子
I'm looking for some example of this type of simple code in C++ and Java and more specially in javascript that can cause Stack Overflow.
推荐答案
在Java中:
public class Test {
public static void main(String[] args) {
main(args);
}
}
通常,任何不终止的递归函数有太多的迭代将导致这个问题。
In general, any recursive function that does not terminate or have too many iterations will cause this problem.
这篇关于在C#,C ++和Java中引起栈溢出的最简单的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文