Computer Applications
What do you mean by type casting? What is type cast operator in Java?
Values & Data Types Java
17 Likes
Answer
The explicit conversion of an operand to a specific type is called Type Casting.
Type Casting in Java is done using the type cast operator. It is a unary operator. It's syntax is:
(<target datatype>) <value>
For example :
int a = 10;
double b = 25.5;
float c = (float)(a + b);
Answered By
10 Likes
Related Questions
Write the Java expression for the following:
What is meant by implicit and explicit type conversion? Explain with an example.
What will be the resultant type of the following expression if bh represents a byte variable, i is an int variable, fl is a float variable and db is a double variable ?
bh - i + db / fl - i * fl + db / iWhat will be the resultant type of the following expression if fl is a float variable and db is a double variable?
(int) (fl + db)