Computer Science, asked by yashchouhan005, 5 months ago

what is casting why do we need it in java​

Answers

Answered by armyonce
6

Answer:

well, you need type casting to get access to fields and methods declared on target type or class. You can not access them with any other type. Let's see a simple example of type casting in Java with two classes Base and Derived which shares same type hierarchy.

Similar questions