https://www.acmicpc.net/problem/27866

정답
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int i = Integer.parseInt(br.readLine())-1;
System.out.println(s.charAt(i));
}
}
풀이
https://lavender1122.tistory.com/297
[Java] charAt(num) 함수
charAt() 함수란?String 타입의 데이터(문자열)에서 특정 문자를 char 타입으로 변환할 때 사용하는 함수 이다.charAt(num) : num 자리에는 int형 변수를 넣어서 원하는 위치 가져올 수 있다.public static void ma
lavender1122.tistory.com
'JAVA > 백준' 카테고리의 다른 글
| [Java] 9086번 : 문자열 (0) | 2024.09.20 |
|---|---|
| [Java] 2743번 : 단어 길이 재기 (0) | 2024.09.20 |
| [Java11] 1546번 : 평균 (0) | 2024.09.12 |
| [Java11] 10811번 : 바구니 뒤집기 (0) | 2024.09.12 |
| [Java11] 3052번 : 나머지 (0) | 2024.09.12 |