OneBite.Dev - Coding blog in a bite size

declare a function with multiple parameter in java

Code snippet on how to declare a function with multiple parameter in java

 public static int add(int a, int b) {
  int c = 0;
  c = a+b;
  return c;
  }

This code is an example of how to declare a function with two parameters (in this case a and b) in Java. The function name is add and it will return an integer (int c). The function will take in two integers (a and b) and add them together and then store the sum in a new integer (int c) which will then be returned by the function.

java