โ Back to Encapsulation
Question 493
Private Helper Method
Private Helper Method
TheCalculatorclass exposes a public methodSumOfSquares(int a, int b)that returnsa*a + b*b. It must do this by calling a PRIVATE helper methodSquare(int n)that returnsn * n. Do NOT write aMainmethod. ForSumOfSquares(3, 4)the program prints: 25
Expected Output:
25
Topics:
Encapsulation
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.