Methods With Multiple Parameters
Ryan Lewis
IT/215 Java Programming
Hann So
November 4th, 2014
When it comes to Java, one has parameters. Parameters are very important in that they are the inputs of a method. Methods can have a singular parameter or methods can have multiple parameters. One opens up parenthesis right after the method name to create a method that has multiple parameters. Following that, one declares the type of the parameter and the variables where you separate the other variables from each other with commas. After this, one then closes the parenthesis(Just Answer, n.d.). An example of this would be something like public void test(double x, double y){}. This method takes two parameters of the double type. When it comes to discussing practical examples for multiple parameters, a function which computes the interests that is earned for a savings account each year can be given as an example. The interest function can have two two parameters. These parameters would be how much money is deposited into the savings account. The other one would be the interest on the savings account. Since we are dealing with money where there needs to be precision, versus float, one would use double types, so both of the parameters would be double types. The function would compute and return the interest that was earned for an account. This would allow a bank to be able to manage their savings accounts in that they could use this method with the two parameters to compute the interest on the accounts. Another practical example of a method that has more than one parameter is a function that