What is casting?

Answer Posted / vijayakumar chinnasamy

Casting means converting values from one data type to
other data type.For example to convert the int values to
float type vlaues.

Types of casting:
1. Downcasting -source is larger than destination type
2. upcasting - Source is smaller than destination type.

casting can be applicable to both primitive type and Object
type.

primitive type - convert numeral to floating point and vice
versa.
Object type - converting from subclass to super class or
vice versa.
superClassObj = subClassObj;

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When do you call copy constructor?

717


In a container there are 5 components. I want to display all the component names, how will you do that?

1811


What are java packages? What is the significance of packages?

748


What is method and methodology?

826


How can we make string upper case or lower case?

770


What is difference between static and abstract class?

720


What does exclamation mean in java?

761


What is canonical name in java?

814


What is illegal identifier in java?

740


How can you make a class serializable in java?

759


What is the purpose of final keyword and when to use it?

748


Define reflection.

730


What is the final access modifier in java?

798


What is arrays aslist in java?

713


what is aggregation in java?

751