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 the difference between final, finally and finalize()?
How dead lock situation occurs in java and how you can identify it?
How do you trim a space in java?
Say any two properties in beans?
What is sortedmap interface?
What is difference between arraylist and list in java?
What is an off by one error in java?
Why string is immutable with example?
What is the purpose of static keyword in java?
What is the difference between a vector & an array list?
Is set ordered?
What are the steps involved to create a bean?
What is the main use of generics in java?
What is java used for?
What is an array in java?