codegen: handle exceptions of a method
[mate.git] / tests / While.java
1 package tests;
2
3 public class While {
4         public static void main(String []args) {
5                 System.out.printf("result: f: 0x%08x\n", f(4, 6));
6                 System.out.printf("result: g: 0x%08x\n", g(4, 6));
7         }
8
9         public static int f(int a, int b) {
10                 do {
11                         a += b;
12                         b--;
13                 } while (b > 0);
14                 return a;
15         }
16
17         public static int g(int a, int b) {
18                 while (b > 0) {
19                         a += b;
20                         b--;
21                 }
22                 return a;
23         }
24 }