看板 TransCSI 關於我們 聯絡資訊
※ 引述《hwamond (a-Hwa)》之銘言: : public class Program1{ : public Program1() : { : system.out.println(cal(10,25)); : } : public static void main(String args[]) : { : Program1 program = new Program1(); : } : public int cal(int a,int b) : { : if(b==1) return a; : else return a+cal(a,b-1); : } : } : 請問他的結果是什麼@@a : 煩請解答 謝謝 不好意思 這篇借用一下 請問有抓蛙魔人可以解釋一下嗎^^" 其實我比較不懂的是 else return a+cal(a,b-1); 這行 :) -- IE7 http://ie7.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.71.22.20
stevennick:應該就是遞迴...還有 "System"S要大寫 06/26 17:36
xsque:Java的大小寫 有嚴格的規定 ! 06/26 18:49
ilay:a+cal(a,b-1) 這是...? 06/27 11:18
xsque:遞迴阿 跟 C用法一樣 06/27 12:14