COERCION IN JAVA
In Java, type coercion (more commonly referred to in Java documentation and developer circles as Type Conversion or Type Casting) is the process of converting a value from one data type to another.
Because Java is a statically typed language, the compiler strictly checks data types. However, Java allows certain automatic conversions when it is safe to do so, as well as manual conversions when you need to force a change.
1. Implicit Type Conversion (Automatic Coercion / Widening)
Implicit coercion happens automatically when you assign a value of a smaller data type to a larger data type. Java handles this safely because there is no risk of data loss. This is known as Widening Primitive Conversion.
Date: 2026-09-04 00:00:00.000000