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 split return?
Where local and global variables are stored?
Explain illegalmonitorstateexception and when it will be thrown?
What are thread safe functions?
Which package is always imported by default?
How concurrent hashmap works?
What are data types in programming?
What is difference between add() and addelement() in vector?
How many ways can you break a singleton class in java?
What do you mean by jjs in java8?
How do you define a variable?
Which collection does not allow duplicates in java?
What is the difference between abstraction and encapsulation?
How do you compare arrays in java?
Is constructor inherited?