In Java, when is it possible to change the method that is called by typecasting the value to the left of the dot?
a. when the method is overridden
b. when the method is overloaded
c. when the method is static
d. when the method is not static
You can choose more than one answer.
Answer Option A
Reason: Option A is correct because we can use method overriding by casting an object to the correct type.
Option B is incorrect because method overloading is not used over here for typecasting
Option C is incorrect because when a method is static type casting cannot be done on it
Option D is incorrect because if a method is not static then overriding the method will work in type casting.
If you liked the solution then give a thumbs up ? it will be really appreciated ?
Get Answers For Free
Most questions answered within 1 hours.