KnowledgeBoat Logo

Computer Applications

What is type conversion? How is an implicit type conversion different from explicit type conversion?

Java Operators

45 Likes

Answer

Type conversion is a process that converts a value of one data type to another data type.

In an implicit conversion, the result of a mixed mode expression is obtained in the higher most data type of the variables without any intervention by the user. For example:

int a = 10;
float b = 25.5f, c;
c = a + b;

In case of explicit type conversion, the data gets converted to a type as specified by the programmer. For example:

int a = 10;
double b = 25.5;
float c = (float)(a + b);

Answered By

28 Likes


Related Questions