When JVM encounters a data type of lower size which occupies less memory, it is assigned to a data type of higher size implicitly by the JVM. This is also known as automatic type conversion. For Example
int i = 1; // 4 bytes double d = i; // 8 bytes
Explicit casting:
When a data type of higher size which occupies more memory, needs to be assigned to a data type of lower size, it is called explicit casting. This type of casting won't be done implicitly by the JVM. This casting operation should be performed by the programmer. For example
double d = 1.0; int i = (int) d;
Liked By
Write Answer
Can you explain about Implicit and Explicit type casting ?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
03-Jul-2015