I am practicing and the simple exercise is, given a FeatureFilm class defined to have the following methods:
public void update(Actor a, String title)
public void update(Actor a, Actor b, String title)
public void update(String topic, String title)
which of the following additional method headers would be allowed by the compiler?
public boolean update(String category, String theater)
public boolean update(String title, Actor a)
public void update(Actor b, Actor a, String title)
public void update(Actor a, Actor b)
So I did the code and the compiler doesn't allow this methods: public boolean update(String category, String theater) and public void update(Actor b, Actor a, String title), but I don't entirely understand why. Someone could explain this to me please?
I hope to be making good use of this site. I'm a OPP beginner.
Sorry about my (poor) English,
Thanks.
Because it is not allowed to have method with same Parameter types and different return type. So:
public void update(String topic, String title) and public boolean update(String category, String theater) has two strings as Parameter, but first one is a void and second one Returns a boolean value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With