Check out example codes for "what is a method example in java". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com