what is casting why do we need it in java
Answers
Answered by
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
India Languages,
2 months ago
Political Science,
2 months ago
Math,
5 months ago
Math,
9 months ago
English,
9 months ago