What is casting?

Answers were Sorted based on User's Feedback



What is casting?..

Answer / kabita

Casting is used to convert the value from one datatype to
another datatype

Is This Answer Correct ?    7 Yes 0 No

What is casting?..

Answer / 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

What is casting?..

Answer / janet

Casting is used to convert the value of one type to another

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is palindrome in java?

0 Answers  


What is preparedstatement in java?

0 Answers  


Explain the purpose of garbage collection in Java?

0 Answers   BirlaSoft,


How does queue work in java?

0 Answers  


what is diffrence between .NET and java?

2 Answers  






design an lru cache in java?

0 Answers  


difference throws and throw in java

3 Answers  


What is local declaration?

0 Answers  


Can we extend singleton class?

0 Answers  


What does 0 mean in boolean?

0 Answers  


What are the uses of final, finally and finalize in java?

2 Answers   Agiline, FINO PayTech, HCL,


What is serializable interface?

13 Answers   Infosys, Probity Soft, Seed Infotech,


Categories