这个汉塔问题中transfer(num-1 , from , temp , to);怎么解读啊?知道是递归可还是看不明白
public class Hannota{public static void main(String[] addf){
transfer(3,'A','B','C');
}
//将num个盘子,从from,移到to,借助temp
static void transfer(int num , char from ,char to,char temp){
if (num == 0) return;
//将 num-1个盘子,从from,移到temp,借助to
transfer(num-1 , from , temp , to);
//将 大盘子 从from移到to
System.out.println(from+" ---> "+to);
//将 num-1个盘子,从temp,移到to,借助from
transfer(num-1 , temp , to , from);
}
}