+ 7

What's the purpose of UPCASTING and DOWNCASTING in java..?

Help me...i can't understand the concept

7th Sep 2017, 7:35 AM
Arun ashok
Arun ashok - avatar
2 Respostas
+ 3
i found this which is straight to the point Upcasting is casting to a supertype, while downcasting is casting to a subtype. Upcasting is always allowed, but downcasting involves a type check and can throw a ClassCastException.
7th Sep 2017, 9:08 AM
D_Stark
D_Stark - avatar
+ 6
thanx @David
8th Sep 2017, 1:20 PM
Arun ashok
Arun ashok - avatar