Explore Library
Code QuizBeginner

Missing Narrowing Cast

Spot why assigning a double to an int fails.

Codejava
public class Convert {
    public static void main(String[] args) {
        double price = 9.99;
        int rounded = price;
        System.out.println(rounded);
    }
}

What is the bug in this code?