OSDN Git Service

2004-08-10 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / inline.java
1 public class inline
2 {
3   static int factorial_1 (int n)
4   {
5     if (n > 0)
6       return n * factorial_1(n-1);
7     return 1;
8   }
9
10   static int factorial_2 (int n)
11   {
12     if (n > 0)
13       return n * factorial_3(n-1);
14     return 1;
15   }
16
17   static int factorial_3 (int n)
18   {
19     if (n > 0)
20       return n * factorial_2(n-1);
21     return 1;
22   }
23
24   public static void main(String args[])
25     {
26       if (factorial_1 (5) != 120)
27         System.out.println("This should not happen");
28       else
29         System.out.println("OK");
30       if (factorial_2 (5) != 120)
31         System.out.println("This should not happen");
32       else
33         System.out.println("OK");
34     }
35 }