Computer Science, asked by madhaviakki1996, 7 months ago

benefits of type casting in java​

Answers

Answered by srinwassap
1

Answer:

hi

Explanation:

  • Upcasting and downcasting gives us advantages, like Polymorphism or grouping of different objects. We can treat an object of a child class type to be as an object of its parent class type. This is called upcasting.
Answered by itsmegitanjali
3

Answer:

It provides compatibility between haterogenous data types

Explanation:

Typecasting is used to convert one date type into other.

Mainly it has two type

1 - Upcasting : In which lower type is converted into upper type

ex- typecasting int into float

2- Downcasting : In which upper type is converted into lower type

ex- typecasting float into int

In downcasting there is possibility of data loss like loosing value after decimal points in case of float to int

Similar questions