MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

control/ForInInt.java:8–21  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

6
7public class ForInInt {
8 public static void main(String[] args) {
9 for(int i : range(10)) // 0..9
10 System.out.print(i + " ");
11 System.out.println();
12 for(int i : range(5, 10)) // 5..9
13 System.out.print(i + " ");
14 System.out.println();
15 for(int i : range(5, 20, 3)) // 5..20 step 3
16 System.out.print(i + " ");
17 System.out.println();
18 for(int i : range(20, 5, -3)) // Count down
19 System.out.print(i + " ");
20 System.out.println();
21 }
22}
23/* Output:
240 1 2 3 4 5 6 7 8 9

Callers

nothing calls this directly

Calls 2

rangeMethod · 0.80
printMethod · 0.80

Tested by

no test coverage detected