강의

멘토링

커뮤니티

Inflearn Community Q&A

yebc0401's profile image
yebc0401

asked

Kim Young-han's Java Tutorial - Your First Step into Java with Code

Type Casting 2 - Explicit Casting

강사님의 형변환결과값이랑 저의 형변환결과값이 다른경우...ㅠㅠ

Written on

·

245

·

Edited

0

=========================================[질문 내용]

public class Casting3 {

    public static void main(String[] args) {
        long maxIntValue= 2147483647;  //int 최고값
        long maxIntOver= 21474836478L;  //int 최고값 + 1(초과)
        int intValue=0;

        intValue = (int) maxIntValue; // 형변환
        System.out.println("maxValue Casting= "+ intValue);

        intValue = (int) maxIntOver; //형변환
        System.out.println("maxIntOver Casting = " + intValue);
    }
}

 

 

근데 저의 결과값은 ..... 이렇게 나오는 이유가 있을까요?

java객체지향형변환

Answer 1

0

안녕하세요. YEDEV님, 공식 서포터즈 OMG입니다.

강의의 영한님이 작성한 값과 차이가 있습니다 😀

2147483648L
21474836478L

image

감사합니다.

yebc0401's profile image
yebc0401

asked

Ask a question