~/ 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/bf4a596f-f0da-4a21-bcba-f2e1f61f1721/flashcard utf-8 LF