-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVarargsOverloading.java
More file actions
29 lines (26 loc) · 1.03 KB
/
Copy pathVarargsOverloading.java
File metadata and controls
29 lines (26 loc) · 1.03 KB
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
public class VarargsOverloading {
static void vaTest(int ... v) {
System.out.println("vaTest(int ...): " + "Number of args: " + v.length);
System.out.println("Contents: ");
for (int i = 0; i < v.length; i++) System.out.println(" arg " + i + ": " + v[i]);
System.out.println();
}
static void vaTest(boolean ... v) {
System.out.println("vaTest(boolean ...): " + "Number of args: " + v.length);
System.out.println("Contents: ");
for (int i = 0; i < v.length; i++) System.out.println(" arg " + i + ": " + v[i]);
System.out.println();
}
static void vaTest(String msg, int ... v) {
System.out.println("vaTest(String, int ...): " + msg + v.length);
System.out.println("Contents: ");
for (int i = 0; i < v.length; i++) System.out.println(" arg " + i + ": " + v[i]);
System.out.println();
}
public static void main(String[] args)
{
vaTest(1, 2, 3);
vaTest("Testing: ", 10, 20);
vaTest(true, false, false);
}
}