Widening Conversions

  1. Recall that these are Java's fundamental data types:


    All values of byte are also values of short.
    All values of short are also values of int.
    All values of int are also values of long.
    All values of long can be approximated by values of float.
    All values of float are also values of double.

  2. So....


    Widening conversion converts a value from one type into another type without causing a large error

  3. Widening conversions in Java:

    NOTE: it chains... for example, conversion from byte to long is also widening.

  4. Java allows widening conversions to take place automatically (without informing the programmer)