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 exactly is methodology?
What is jvm? Why is java called the platform independent programming language?
What is the difference between choice and list?
What is a condition in java?
When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?
Which is faster set or list in java?
What does java stand for?
Explain about java sdk?
What is the order of arraylist in java?
Explain differences between collection api and stream api?
What is the effect of keeping a constructor private?
How do you reverse sort in java?
Can we declare the main method of our class as private?
What is the java project architecture?
What is the purpose of extern variable?