Network disconnected
Description
코드 4번째 줄에 System.out.println(number);
는 number라는 변수를 출력합니다. 그런데, number 변수가 선언되어 있지 않네요. 변수는 반드시 사용하기 전에 선언해 주어야 합니다.
4번째 줄에 정수형 변수, number를 선언하고 3이란 값을 대입해보세요.
힌트[1]
변수는 다음과 같이 선언합니다.
// 정수를 담는 변수, count 선언
int count;
// 실수를 담는 변수, average 선언
double average;
변수를 선언하면서, 동시에 변수에 값을 할당할 수 있습니다.
// 정수를 담는 변수, count를 선언하고 여기에 10을 저장합니다.
int count = 10;
// 실수를 담는 변수, average를 선언하고 여기에 11.1을 저장합니다.
double average = 11.1;
[1]: int number = 3;
이라 적고 코드를 채점해보세요.
Question type: Fill in the blank
- You need to fill in the blank with the appropriate code.
- You cannot modify the given code.
- An error message will appear in the result if you leave the blank empty.
1
2
3
4
5
6
7
public class VariableExam {
public static void main(String[] args) {
// 정수형 변수, number를 선언하고 3을 저장해보세요.
System.out.println(number);
}
}
Result
Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.