Two methods with the same name but different signatures represent method overloading. Here is an example:
public class MyClass {
public String method(int i){
//statements
}
public int method(int i, String v){
//statements
}
}
The following is not allowed and will cause a compilation error, because return values are not a part of the method signature and cannot be used to distinguish one method from another if they have the same signature:
public class MyClass {
public String method(int i){
//statements
}
public int method(int i){ //error
//statements
}
}
Yet, this is allowed, because the methods have different signatures:
public String method(String v, int i){
//statements
}
public String method(int i, String v){
//statements
}