~/ learn/ java-from-zero/ cards/ Casting & numeric promotion
1 of 2

Type a narrowing cast

Type a narrowing cast

Answer

int i = (int) 9.99;

Casting double to int truncates the fraction — i becomes 9, never rounds.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/d83a8c67-5f0a-459b-ae20-fc126441c9db/flashcard utf-8 LF