Última atividade 1729274913

a small difference makes results wildly different

WhoaWhat.java Bruto
1
2public class WhoaWhat {
3 public static void main(String[] args) {
4 System.out.println(doOne() + " " + doTwo());
5 // will print 2048 4 - but why?
6 }
7 private static int doOne() {
8 int result = 2;
9 for(int i = 0; i < 10; i++)
10 {
11 result = result * 2;
12 }
13 return result;
14 }
15 private static int doTwo() {
16 int result = 2;
17 for(int i = 0; i < 10; i++);
18 {
19 result = result * 2;
20 }
21 return result;
22 }
23}
24