← 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
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Methods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.