还是只是练习?
我问这个问题是因为我和教授的一个争论: 我失去了在课堂上没有涉及到递归的基础上递归调用函数的信誉,我的争论是我们通过学习 return
和方法隐式地学习了递归。
我这么问是因为我怀疑有人能给出明确的答案。
例如,以下两种方法的区别是什么:
public static void a() {
return a();
}
public static void b() {
return a();
}
Other than "a
continues forever" (in the actual program it is used correctly to prompt a user again when provided with invalid input), is there any fundamental difference between a
and b
? To an un-optimized compiler, how are they handled differently?
归根结底,是否通过从 b
学习到 return a()
,我们也因此从 a
学习到 return a()
。有吗?