what are upcasting and downcasting?

Answer Posted / arjun kumar

When we cast a reference along the class hierarchy in a
direction from the sub classes towards the root, it is an
upcast.
When we cast a reference along the class hierarchy in a
direction from the root class towards the children or
subclasses, it is downcast.

Is This Answer Correct ?    19 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?

993


Can a class have an interface?

552


What is the full meaning of java?

529


What are different types of expressions?

552


Why is java multithreaded?

533






How java is similar to c?

584


What is the difference between access specifiers and access modifiers in java? 16

534


What is java in simple terms?

554


What are three types of loops in java?

583


What is compiler and what its output.

632


How do you override a variable in java?

526


what methods would you overwrite in java.lang.object class?

560


How do you convert an int to a string in java?

539


Why put method is used?

522


What are the different tags provided in jstl?

547