```
public class Variablescope{
public static void main(String[]args){
int x = 5;
System.out.printLn("x=" + x);
print(x);
System.out.printLn("x=" + x);
}
public static void print(int x){
System.out.printLn("x=" + x);
x = x + 10;
System.out.printLn("x=" + x);
}
}
```
입력하니까
```
/root/var/tmp/2023_07_14_03_27_04_d1513ffe/Variablescope.java:4:error:cannot find symbol
System.out.printLn("x="+x);
^
symbol:method printLn(String)
location:variable outof type PrintStream
/root/var/tmp/2023_07_14_03_27_04_d1513ffe/Variablescope.java:6:error:cannot find symbol
System.out.printLn("x="+x);
^
symbol:method printLn(String)
location:variable outof type PrintStream
/root/var/tmp/2023_07_14_03_27_04_d1513ffe/Variablescope.java:9:error:cannot find symbol
System.out.printLn("x="+x);
^
symbol:method printLn(String)
location:variable outof type PrintStream
/root/var/tmp/2023_07_14_03_27_04_d1513ffe/Variablescope.java:11:error:cannot find symbol
System.out.printLn("x="+x);
^
symbol:method printLn(String)
location:variable outof type PrintStream
4errors
```
나와요ㅠㅠ 어디서 잘못된걸까요?
sehongpark님의 답변
이렇게 바꿔보세요
```
public class VariableScope {
public static void main(String[] args) {
int x = 5;
System.out.println("x=" + x);
print(x);
System.out.println("x=" + x);
}
public static void print(int x) {
System.out.println("x=" + x);
x = x + 10;
System.out.println("x=" + x);
}
}
```
해설은 다음과 같습니다.
오타:
"System.out.printLn"은 올바른 출력 메서드가 아닙니다.
올바른 메서드는 "System.out.println"입니다.
모든 인스턴스에서 "System.out.println"을 올바르게 사용해야 합니다.