首页 > 代码库 > 递归入门

递归入门

 1 import java.io.IOException; 2  3 public class Digui1 { 4  5     public static void main(String[] args) { 6         // TODO Auto-generated method stub 7         Digui1  d= new Digui1(); 8         try { 9             d.printInput();10         } catch (IOException e) {11             e.printStackTrace();12         }13     }14     15     private void printInput() throws IOException {16          char i = (char) System.in.read(); 17          if (i != ‘#‘) {18              printInput();19          }20          if (i != ‘#‘) {21              System.out.print(i); 22          }         23     }24 25 }

递归入门