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

How do you escape a string?

510


Define how does a try statement determine which catch clause should be used to handle an exception?

588


What is proper subset?

537


Print Vertical traversal of a Binary Tree.

615


What do you mean by local variable and instance variable?

520






How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

547


Name component subclasses that support painting in java programming?

642


What do you mean by compiler?

587


How to sort array in descending order in java?

519


What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

522


Can inner class extend any class?

600


Is string is a data type in java?

595


Is null a string in java?

558


What is class array in java?

517


What is e java?

561