forked from SoongSilComputingClub/23H1-study_java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
49 lines (39 loc) · 1.24 KB
/
Main.java
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
41
42
43
44
45
46
47
48
49
package JavaStudy;
import java.util.*;
public class Main {
private int korean =80;
private int english =75;
private int math=55;
private String hong ="881120-1068234";
private String a= "a:b:c:d";
public void first(){
System.out.println("3-1의 답은?");
System.out.println((korean+english+math)/3);
}
public void second(){
System.out.println(hong.substring(0,6));
System.out.println(hong.substring(7,14));
}
public void third(){
System.out.println(a.replaceAll(":","#"));
}
public void fourth(){
ArrayList<String> myList = new ArrayList<>(Arrays.asList("Life","is","too","short"));
String result= String.join(" ",myList);
System.out.println(result);
}
public void fifth(){
ArrayList<Integer> numbers=new ArrayList<>(Arrays.asList(1,1,1,2,2,3,3,3,4,4,5));
HashSet<Integer> num=new HashSet<>(numbers);
ArrayList<Integer> NewList = new ArrayList<>(num);
System.out.println(NewList);
}
public static void main (String[]args) {
Main homeWork = new Main();
homeWork.first();
homeWork.second();
homeWork.third();
homeWork.fourth();
homeWork.fifth();
}
}