Answer Posted / vijayakumar chinnasamy
Casting mostly used for converting value from one data type
to another data type.Mostly used for convert incompatible
data.
eg:
WRRONG
long a=20; // a is 64bit(long) data
int b=10; // b is 32 bit data.
b=a; // u r trying to assign 64bit data into 32 bit data
CORRECT
long a=20; // a is 64bit(long) data
int b=10; // b is 32 bit data.
b=(int)a; // ur converting 64bit data into 32bit data
then assign to variable b.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is a method vs function?
How do you empty a list in java?
Is singleton set an interval?
Explain the public class modifier?
What is ordered map in java?
Why java does not support pointers?
What do you know about the garbate collector?
What are the data types supported by java?
What is boolean data type in java?
How can a gui component handle its own events in java programming?
What do you mean by hashing?
5 Coding best practices you learned in java?
What is the function of http?
What are classloaders?
What is namespace in java?