- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringMethod9.java
More file actions
Latest commit
29 lines (18 loc) · 609 Bytes
/
Copy pathStringMethod9.java
File metadata and controls
29 lines (18 loc) · 609 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
packageco.in.nextgencoder.class5;
publicclassStringMethod9 {
publicstaticvoidmain(String[] args) {
// Hello World Program
Stringstr = "Hello World Program";
StringstrArr[] = str.split(" "); // Hello, World, Program
// Hello, World, Program
// Hello-World-Program
// Join joins String array elements to single array
Stringoutput = String.join( "-", strArr);
System.out.println(output);
Stringarr[] = { "02", "10", "2020"};
// { "02", "10", "2020" } -> "02/10/2020"
Stringdate = String.join("/", arr);
System.out.println(date);
// 02/10/2020
}
}