/* */ Click to Join Live Class with Shankar sir Call 9798158723

What is Predefined Methods in Java ?

Predefined Methods in Java is say that say that the methods that don’t need to be created by the user/programmer are called predefined methods in java. It is also known as the standard library method or built-in method. We can directly use these methods just by calling them in the program at any point.

Q.) Example of Predefined Methods in Java ?
    class Main {

// create a method
public int addNumbers(int a, int b) {
  int sum = a + b;
  // return value
  return sum;

public static void main(String[] args) {
  int num1 = 25;
  int num2 = 15;

  // create an object of Main
  Main obj = new Main();
  // calling method
  int result = obj.addNumbers(num1, num2);
  System.out.println("Sum is: " + result);
Sum is: 40