为什么递归调用后 System.out.println(res) 仍然运行?我认为它永远不会到达 System.out.println(res);
public class recursion
{
public static void main(String[] args)
{
recursion p = new recursion();
p.perms(4, "");
}
public void perms(int remaining, String res)
{
if (remaining > 0) {
perms(remaining - 1, res + "1");
System.out.println(res);
}
}
}