Method overloading in Java
- Lucas
- June 11, 2014
In Java you can declare methods with the same name in a class, but each method must contain different sets of parameters. In other words, this is called Method Overloading. public class Calculadora{ public int soma(int valor1, int valor2){ return valor1 + valor2; } public float soma(float valor1, float valor2){ return valor1 + valor2; }