Java Type Casting

Implicit Casting (Widening)

Automatic conversion from smaller to larger types, e.g., int to long.

Explicit Casting (Narrowing)

Manual conversion required for larger to smaller types, e.g., double to int:

int i = (int) 3.14;

Type Casting between Objects

Use instanceof to check before downcasting between object types.