what is a method example in java

Java
public int addNum(int num1, int num2) {
  total = num1 + num2;
  System.out.println("Total: " + total);
}
Source

Also in Java: