package cn.itcast.递归;
public class Hanno {
public static void main(String[] args) {
trans(3,'A','B','C');
}
public static void trans(int n,char from,char to,char temp){
if(n==1){
System.out.println(from+"--------->"+to);
}
else{
trans(n-1,from,temp,to);
System.out.println(from+"--------->"+to);
trans(n-1,temp,to,from);
}
}
}
/*
下面两个递归不是很明白
*/ |
|