Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

ย 

History

History
History
39 lines (32 loc) ยท 1.21 KB

File metadata and controls

39 lines (32 loc) ยท 1.21 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก
import java.util.Scanner;
public class c1026 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("์‹œ๋ถ„์ดˆ ์ž…๋ ฅ: ");
String date = sc.nextLine();
sc.close();
String[] arr = date.split(":"); // ':'๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๋ฐฐ์—ด์— ์ €์žฅ
for (int i = 0; i < arr.length; i++){
String a = arr[i];
if (i == 1){ // ์ž…๋ ฅ๋œ ๋ฐ์ดํ„ฐ ์ค‘ '๋ถ„'๋งŒ ์ถœ๋ ฅ
System.out.println(a);
}
}
/*String clock = sc.nextLine();
String arr[] = clock.split(":");
int arr2[] = new int[arr.length];
for(int i = 0; i < arr.length; i++){
arr2[i] = Integer.parseInt(arr[i]);
}
System.out.printf("%02d", arr2[1]);*/
}
}// end c1025
// ์ž…๋ ฅ ํด๋ž˜์Šค์ธ Scanner ๊ฐ์ฒด ์ƒ์„ฑ
// ์ž…๋ ฅ ํ˜•์‹์— ๋งž์ถฐ ์‹œ๊ฐ„์„ ์ž…๋ ฅ๋ฐ›์Œ
// ์ž…๋ ฅ ์ข…๋ฃŒ๋˜์—ˆ์œผ๋ฏ€๋กœ sc ๊ฐ์ฒด ๋‹ซ๊ธฐ
// ':'๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๋ฐฐ์—ด์— ์ €์žฅ
// for๋ฌธ์„ ์ด์šฉํ•˜๋ฉด์„œ if๋ฌธ์œผ๋กœ ์กฐ๊ฑด์„ ์„ค์ •ํ•˜์—ฌ '๋ถ„'๋งŒ ์ถœ๋ ฅ
// - i๊ฐ€ 0, arr[0]์€ '์‹œ'
// - i๊ฐ€ 1, arr[1]์€ '๋ถ„'
// - i๊ฐ€ 2, arr[2]์€ '์ดˆ', for๋ฌธ ์ข…๋ฃŒ
Morty Proxy This is a proxified and sanitized view of the page, visit original site.