문제의 코드
int num = 10; // 정수
public class Var01 { // 1. 클래스 이름 (오브젝트)
public static void main(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름)
}
}
결과
실행 자체가 되지 않음.
해결
public class Var01 { // 1. 클래스 이름 (오브젝트)
public static void main(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름)
int num = 10; // 정수
System.out.println(num);
}
}
이유
변수 타입은 클래스 안에 둬야한다.
Share article