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 starvation?
What is factor r?
What are synchronized methods ?
What is the difference between super class & sub class?
What is the difference between logical data independence and physical data independence?
Why do we need wrapper class?
Explain the difference between call by refrence and call by value?
State some advantages of java?
What is the purpose class.forname method?
When should you use arraylist and when should you use linkedlist?
What is a method header?
Is there any difference between synchronized methods and synchronized statements?
What is the difference between an object-oriented programming language and object-based programming language?
What do you mean by garbage collection used in java?
What is a top level class in java?