Narrowing Conversion

An explicit numeric conversion that may lose range or precision.

What is Narrowing Conversion in Java?

Narrowing Conversion — An explicit numeric conversion that may lose range or precision.

class TicketCounter {
    void convertValues() {
        int tickets = 7;
        double exactTickets = tickets;
        int wholePrice = (int) 7.9;
    }
}

Level: Novice · More Java terms at this level

Updated