2) Widening Conversion (Automatic)
Moving a smaller type into a larger one is safe and automatic.
// int → double (automatic)
int score = 95;
double grade = score; // 95.0 (no data lost)
Why it’s safe: The larger type can represent every value of the smaller type.
3) Narrowing Conversion (Manual)
Moving a larger type into a smaller one can lose data. You must cast explicitly.
// double → int (manual, truncates)
double pi = 3.14159;
int whole = (int) pi; // 3 (fraction dropped, not rounded)
Heads-up: Casting from floating-point to integer truncates—no rounding.