문제 & 예시
소스코드
// 문자열을 정수로 바꾸기
public class test18 {
public static void main(String[] args) {
Solution18 sol = new Solution18();
String s = "-1234";
System.out.println(sol.solution(s));
}
}
class Solution18 {
public int solution(String s) {
int answer = 0;
// 문자열을 정수형으로 변환
answer = Integer.parseInt(s);
return answer;
}
}