โ Back to Methods
Question 145
Overloaded Area Methods
Overloaded Area Methods
Method overloading means two methods can share a name if their parameters differ. Write TWO static methods namedArea: -Area(int side)returns side * side (a square) -Area(int width, int height)returns width * height (a rectangle) Do NOT write a Main method. For Area(5) it prints 25; for Area(4, 6) it prints 24.
Expected Output:
25 24
Topics:
Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.