1 public class DiGui { 2 public static void main(String[] args) { 3 DiGui diGui = new DiGui(); 4 System.out.println(diGui.add(1)); 5 public int add(int sum){ 6 if(sum == 100){ 7 return 100; 8 }else{ 9 return sum+add(sum+1); //无限循环到+100 10 } 11 }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/273774.html