In the Rectangle class:
1. Change the getHeight and getWidth methods so that they return HasHeight and HasWidth objects, respectively.
2. To do this, inside the getHeight and getWidth methods, create local classes that implement the interfaces.
Refactoring Rectangle
- 13
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
13 January 2022, 13:59
This task is a good illustration of how deep the nesting can go. You end up with a method inside a class inside a method inside a class. Is there a limit to how much nesting is possible?
0
Jurij Thmsn
22 October 2021, 13:33
Confusing task .
Don't forget to change the return types of the static methods:
0