Please enable JavaScript to use CodeHS

CodeHS Glossary


Method Overloading Java

Classes can have multiple methods with the same name, as long as the parameters to those methods are different. Doing this is called "overloading" a method. The method name can be the same, as long as the method signature is different. Each of these methods could all be in the same class and there would be no conflict: ``` private int sum(int one, int two) private double sum(double one, double two) private double sum(int one, double two) private double sum(double one, int two) ``` Java can figure out which method is being called based on the types of the parameters, and the order of the parameters.