When I want to do an add method that takes 2 parameters, how can I make the method universal? That is, when a method accepts int numbers, you cannot send double numbers to it. When the method accepts double parameters, you will not be able to send int numbers to it. With int float and double number types, there are many possibilities, e.g.
public int add(int firstNumber, int secondNumber) {
return firstNumber + secondNumber;
}
public float add(int firstNumber, float secondNumber) {
return firstNumber + secondNumber;
}
public float add(float firstNumber, int secondNumber) {
return firstNumber + secondNumber;
}
e.t.c...
What should I do to make the method work properly and take numbers in every possible configuration?