Explicit vs. Smart Casting

Learn to handle type conversion challenges and leverage smart-casting features for safer and more efficient coding practices.

Explicit casting

We can always use a value whose type is Int as a Number because every Int is a Number. This process is known as up-casting because we change the value type from lower (more specific) to higher (less specific).

Get hands-on with 1400+ tech skills courses.