what is meant by UP& DOWN casting in java?

Answer Posted / regalla soujanya naresh reddy

A super class reference can be converted into a subclass
reference but this
subclass reference is not useful to call the methods of any
of the classes. This convention is known as Downcasting.

We can convert the subclass reference to a superclass
reference without using the cast operation compiler because
it will internally take care of the casting. This is known
as Upcasting.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 8 primitive data types in java?

550


What is try-with-resources in java?

618


What does null mean in java?

633


What is difference between classpath and path variables in java?

560


Explain the scope or life time of class variables or static variables?

522






what is session in java?

757


What technique can be employed to compare two strings?

578


What’s meant by anonymous class?

606


Can we have 2 main methods in java class?

543


What is thread start?

526


What is difference between string and stringbuffer?

499


Can we have multiple classes in a single file?

517


What is scope of a variable?

607


Which is faster string or stringbuilder?

522


What is ordered map in java?

543