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 does system.gc() and runtime.gc() methods do?

0 Answers  


What are the important features of Java 10 release?

0 Answers  


What are the different ways of creating thread?

0 Answers  


What is the purpose of static keyword in java?

0 Answers  


Can we have multiple catch block for a try block?

0 Answers  






Write the algorithm to check the number non-leaf nodes in a tree.

0 Answers   Amdocs,


Why java is made?

0 Answers  


What is a java list?

0 Answers  


Hi Friends, can you explain instance in java. In general instance means "occurence of something" . In java what is instance.

4 Answers  


What is sorting in java?

0 Answers  


What do you mean by chromounits in java8?

0 Answers  


What is treeset in java?

0 Answers  


Categories