explicit type casting code example
Example 1: Explicit Casting
double myDouble = 9.78;
int myInt = (int) myDouble; // Manual casting: double to int
Console.WriteLine(myDouble); // Outputs 9.78
Console.WriteLine(myInt); // Outputs 9
Example 2: what is explicit casting
/*
Type Casting Types in Java
Java Type Casting is classified into two types.
- Widening Casting (Implicit) – Automatic Type Conversion
- Narrowing Casting (Explicit) – Need Explicit Conversion
source: https://www.tutorialspoint.com/what-are-the-differences-between-widening-casting-implicit-and-narrowing-casting-explicit-in-java
*/