Network disconnected
Description
int 타입 변수, intValue
의 값을 long 타입 변수에 넣으려 합니다. 빈칸에 long 타입 변수, longValue
를 선언하고, 변수를 intValue
를 이용해 초기화해주세요.
힌트[1]
기본형 타입을 변환하는 방법에 대해 알아봅시다.
- 묵시적 형 변환
- 크기가 작은 타입을 크기가 더 큰 타입으로 바꿀 때는 컴파일러에 별도의 명령을 하지 않아도 됩니다.
예를 들어,
int x = 50000;
// 형 변환이 묵시적으로 이루어집니다.
long y = x;
[1]: long longValue = intValue;
라고 적고, 코드를 제출해보세요.
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
8
public class TypeCastingExam {
public static void main(String[] args) {
int intValue = 200;
//빈칸에 long타입 변수 longValue를 선언하고 변수를 intValue를 이용해 초기화해보세요.
System.out.println(longValue);
}
}
Result
Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.