반응형 float (1) 썸네일형 리스트형 자바 - float 변수에 실수 값을 그냥 넣으면 에러 나는 이유 목차 문제 이유 해결책 문제 public class Main { public static void main(String[] args) { float number = 1.1; } } 데이터 타입이 float인 number라는 변수에 실숫값 1.1을 할당해 보자. example.java:3: error: incompatible types: possible lossy conversion from double to float float number = 1.1; ^ 1 error error: compilation failed shell returned number라는 변수의 데이터 타입이 실수(float)인데 실숫값이 할당이 안된다??? 이유 위에 에러 내용을 보면, double 형태에서 float 형태로 변환 .. 이전 1 다음