how to call a void method with parameters in java

Solutions on MaxInterview for how to call a void method with parameters in java by the best coders in the world

showing results for - "how to call a void method with parameters in java"
Lea
10 May 2020
1public class methods{
2  public static void main(String[] args){
3    printSum(5, 15); // Print 20
4  }
5  public static void printSum(int a, int b){
6    System.out.println(a + b);
7  }
8  // Our method should be outside the main methods bounds
9  // Call your function inside the main method.
10}