본문 바로가기

코딩 테스트 연습/알고리즘

[ 코딩테스트 ] 문자열을 정수로 바꾸기

문제

조건

 

정답

class Solution {
    public int solution(String s) {
        int answer = 0;
        answer = Integer.parseInt(s);
        return answer;
    }
}​

 


 

후기

 

참조형  Integer 클래스 기능 중 paresInt 라는 int로 바꿔주는 메서드 사용하기