-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathVarArgs3.java
More file actions
40 lines (29 loc) · 941 Bytes
/
VarArgs3.java
File metadata and controls
40 lines (29 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package chapter7;
public class VarArgs3 {
static void vaTest(boolean... v) {
System.out.print("vaTest(Boolean ...v) Number of args : " + v.length + " Contents: ");
for (boolean x : v) {
System.out.print(x + " ");
}
System.out.println();
}
static void vaTest(int... v) {
System.out.print("vaTest(int ...v) Number of args : " + v.length + " Contents: ");
for (int x : v) {
System.out.print(x + " ");
}
System.out.println();
}
static void vaTest(String msg, int... v) {
System.out.print("vaTest(String , int ...v)" + msg + " " + v.length + " Contents: ");
for (int x : v) {
System.out.print(x + " ");
}
System.out.println();
}
public static void main(String[] args) {
vaTest(1, 2, 3);
vaTest("Testing ", 10, 20);
vaTest(true, false, false);
}
}