javacautoboxingcoerciontype-coercion

What is the difference between autoboxing and coercion?


I program in Java, C and Python.

The rule for automatic coercions among arithmetic types have been augmented to handle the richer set of types

Source: "The C Programming Language"

But what does "coercion" mean? The answers say it's like type conversion and implicit casts and implicit type conversions and called autoboxing where I read it.

What is the difference between autoboxing and coercion?


Solution

  • Coercion is another name for an implicit type cast, i.e. one mandated by the language rules, and not explicitly added by the programmer.