In the recursion, if I have the following sample code
public class StringPractice {
public static void main(String[] args){
hello();
}
public static void hello(){
System.out.println("heloo world!");
hello();
}
}
it will result in StackOverFlowError. However if I'm using while loop, for example while(true) and printout the function hello, it keeps looping with the output but doesn't give us StackOverFlowError. Can somebody explain why? Whats the different ?