โ Back to Miscellaneous
Question 408
Sum with Varargs
Sum with Varargs
Write astaticmethod namedsumthat accepts a variable number ofintarguments (varargs) and returns their total. Inmain, print the results of two calls, each on its own line, exactly: 6 100 The first call issum(1, 2, 3)(which is6) and the second issum(10, 20, 30, 40)(which is100).
Expected Output:
6 100
Topics:
Miscellaneous
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.