call a function with parameter in java
Code snippet on how to call a function with parameter in java
public void doSomething(int number) {
// code to be executed
}
// calling the doSomething() function with parameter
doSomething(10);
This code is an example of how to call a function with a parameter in Java. The function is named “doSomething” and it takes an integer as an argument. To call the function, we use the name of the function followed by parentheses and the value of the argument within the parentheses. In this example, the argument is the number 10. When the code is executed, the “doSomething” function will run, and it will use the value of the argument (10) as a parameter.