``` import java.util.Scanner; public class abcd { Scanner SC = new Scanner(System.in); System.out.print("Input the number : "); int number = sc.nextInt(); System.out.print("Input operation : "); int operation = sc.nextInt(); ``` 스캐너를 사용하려하는데 out.에서 오류 뜨고 ) 뒤에서 오류가 나는데 왜 그러는 걸까요...
오류내용을 올려주세요
Multiple maker at this line -Syntax error on token ".", @expected after this token -Syntax error, insert ")" to complete Method Declaration -Syntax error, insert "identifier (" to complete MethodHeaderName -Syntax error, insert "SimpleName " to complete QualifiedName sc cannot be resolved sc까지 오류였는데 이렇게 쓰여있었습니다!
## main 메소드 메인 메소드가 아닌 필드의 영역에서 프로그램을 동작시켜 생긴 문제입니다. 아래와 같이 변경해보세요. ``` import java.util.Scanner; public class ABCD { public stativ void main(String[] args) { Scanner SC = new Scanner(System.in); System.out.print("Input the number : "); int number = sc.nextInt(); System.out.print("Input operation : "); int operation = sc.nextInt(); // ... } } ```
정말 단순한 문제였는데 미처 생각을 못했네요. 감사합니다ㅎ
쉬엄쉬엄 하세요^^