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

Method main

arrays/FillingArrays.java:10–42  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8
9public class FillingArrays {
10 public static void main(String[] args) {
11 int size = 6;
12 boolean[] a1 = new boolean[size];
13 byte[] a2 = new byte[size];
14 char[] a3 = new char[size];
15 short[] a4 = new short[size];
16 int[] a5 = new int[size];
17 long[] a6 = new long[size];
18 float[] a7 = new float[size];
19 double[] a8 = new double[size];
20 String[] a9 = new String[size];
21 Arrays.fill(a1, true);
22 show("a1", a1);
23 Arrays.fill(a2, (byte)11);
24 show("a2", a2);
25 Arrays.fill(a3, 'x');
26 show("a3", a3);
27 Arrays.fill(a4, (short)17);
28 show("a4", a4);
29 Arrays.fill(a5, 19);
30 show("a5", a5);
31 Arrays.fill(a6, 23);
32 show("a6", a6);
33 Arrays.fill(a7, 29);
34 show("a7", a7);
35 Arrays.fill(a8, 47);
36 show("a8", a8);
37 Arrays.fill(a9, "Hello");
38 show("a9", a9);
39 // Manipulating ranges:
40 Arrays.fill(a9, 3, 5, "World");
41 show("a9", a9);
42 }
43}
44/* Output:
45a1: [true, true, true, true, true, true]

Callers

nothing calls this directly

Calls 2

fillMethod · 0.65
showMethod · 0.65

Tested by

no test coverage detected