I have a Java assignment. I am supposed to make a class with two "Multiply" methods one returns the result and the other returns void and modifies the object that invokes it.
How is this possible in Java? Just giving me some keywords for where to look would be very helpful. Inheritance? Polymorphism? Interfaces? Abstract classes?
Yeah I didn't know that the methods should take the same parameters. That would have been good to know haha. Yeah the only other way I can think of some sort of solution is through simple inheritance. The parent and child can have
multiply and you can call
super.multiply() from within the child. And yah I guess it's unfortunate that Java type signatures doesn't include the return type. It does make a bit of sense why that's the case though. Well good luck on finding a solution :)