Type Casting in Java | Core Java Tutorials
This Core Java Tutorials “Type casting in java” post explains clearly what is type casting and classification of type casting including implicit and explicit type casting with examples in Java.
- Conversion of data from one data type to another data type.
- Type Casting will be done at runtime.
- Java allows Primitive casting and Object casting
- Casting can be either Implicit or Explicit.
- Implicit casting (internal) done by JVM
- Explicit casting (external) done by Programmer.
Implicit casting : Converting Lower data type into Higher type
- byte to int
- byte to short
- short to int
- char to int
- int to float
Explicit casting : Converting Higher type data into Lower type
- int to char
- int to byte