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

Why we use methods in java?

533


What does || mean in vectors?

473


Can you call a method on a null object?

559


Explain methods specific to list interface?

551


What is the difference between the boolean & operator and the && operator in java programming?

562






Explain the meaning of java applet.

602


Explain 5 features introduced in jdk 1.7?

609


What is the collection interface?

584


Is a char always 1 byte?

504


Can you explain the meaning of aggregation and composition

567


Can you explain the private protected field modifier?

567


What is the order of arraylist in java?

603


What if I write static public void instead of public static void in java?

577


Explain the differences between static and dynamic variables?

580


What is operator overloading. Is it is supported in java?

516