코딩도 개발... 축구도 개발... 하...

2017년 7월 27일 목요일

7. 명시적 형 변환


package org.opentutorials.javatutorials.typechange;

public class typeFixChange {
    public static void main(String[] args) {
        float a = (float)100.0;
        int b = (int)100.0F;
        System.out.print(a);
        System.out.print(b);
    }
}

강제로 형 전환이 필요할 때는

float a = (float)100.0;
int b = (int)100.0F;
이런식으로 처리가 가능하다

댓글 없음:

댓글 쓰기