JAVA- If you have an int as the actual parameters, will it change to fit the parameters if it requires a double, or will the code not compile? and vice versa, if you have a double but the parameters call for an int.

ex.
something(int x);

x= 5.0;

Respuesta :

If you have only 1 method that is not overloaded, then you will not be able to call it with inappropriate parameter types, that is, if the initial type of the parameter is int, then it will not be able to get the double, float, and other values, because of this an error will occur.

For this, method overloading is created.

Method overloading is when you create methods with the same name, but only the content and parameters of the methods are/can-be completely different.

ACCESS MORE