an explicit cast operator we have already discussed (section how conversions and casting work for base types nextwe discuss how they work for reference variables casting and generics in this sectionwe discuss casting among reference variablesas well as techniquecalled genericswhich allow us to avoid explicit casting in many cases casting we begin our discussion with methods for type conversions for objects widening conversions widening conversion occurs when type is converted into "widertype the following are common cases of widening conversionst and are class types and is superclass of and are interface types and is superinterface of is class that implements interface widening conversions are automatically performed to store the result of an expression into variablewithout the need for an explicit cast thuswe can directly assign the result of an expression of type into variable of type when the conversion from to is widening conversion the example code fragment below shows that an expression of type integer ( newly constructed integer objectcan be assigned to variable of type number integer new integer( )number ito number /widening conversion from integer the correctness of widening conversion can be checked by the compiler and its validity does not require testing by the java run-time environment during program execution narrowing conversions narrowing conversion occurs when type is converted into "narrowertype the following are common cases of narrowing conversions