강의

멘토링

커뮤니티

Inflearn Community Q&A

ddr478525103's profile image
ddr478525103

asked

Introduction to Java Programming Course (renewed version) - From beginner to developer employment!!

Special characters and formatting characters

소수점 제한기능 관련 질문입니다.

Written on

·

223

1

double d2 = 1.234567; 로 설정했을 때

System.out.printf("%f\n",d2);

System.out.printf("%.0f\n",d2);

System.out.printf("%.1f\n",d2);

System.out.printf("%.2f\n",d2);

System.out.printf("%.3f\n",d2);

System.out.printf("%.4f\n",d2);

의 값이 1  1.2 1.23 까지는 정상적으로 가다가 그 다음부터는 1.235. 1.23457 식으로 출력되는데 자동으로 반올림이 적용되는 건가요?

java

Answer 1

1

네, 자동으로 반올림 해주는걸로 알아용

ddr478525103's profile image
ddr478525103

asked

Ask a question