-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathArray.java
More file actions
28 lines (22 loc) · 602 Bytes
/
Array.java
File metadata and controls
28 lines (22 loc) · 602 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
import java.util.*;
public class Array
{
public static void main(String[] args)
{
System.out.print("\n" + "Join Array:" + "\n");
String[] x = {"alpha","bravo","charlie","delta","echo","foxtrot"};
String y = "#";
Array.join(x,y);
System.out.print("\n");
}
public static void join(String[] items,String delimiter)
{
StringBuffer buffer = new StringBuffer();
for(String item : items)
{
buffer.append(item);
buffer.append(delimiter);
}
System.out.print(buffer.toString() + "\n");
}
}