If a class has a static method sum()
and an instance method sum()
, which one will be called in the following code?
public class Adder {
public static int sum(int a, int b) {
return a + b;
}
public int sum(int a, int b, int c) {
return a + b + c;
}
public static void main(String[] args) {
System.out.println(sum(1, 2));
}
}