The method signature `add(int x, int y)` defines a method named `add`, which accepts two integer parameters `x` and `y`. The method adds the values of `x` and `y` together and returns an integer result.
Think of this method as a calculator where you can input two numbers, `x` and `y`, and it will add them up to give you the sum.
subtract(int x, int y): A method that accepts two integers, subtracts the value of the second integer from the first integer, and returns an integer result.
multiply(int x, int y): A method that accepts two integers, multiplies them together, and returns an integer result.
divide(int x, int y): A method that accepts two integers, divides the first integer by the second integer, and returns a floating-point number.
Study guides for the entire semester
200k practice questions
Glossary of 50k key terms - memorize important vocab
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.