1.
class Test {
void show(int a) { }
void show(long a) { }
public static void main(String[] args) {
Test t = new Test();
t.show(10);
}
}
ANSWER: show(int a)
2.
class Test {
void show(Integer a) { }
void show(int a) { }
public static void main(String[] args) {
Test t = new Test();
t.show(10);
}
}
ANSWER: show(int a)
3.
class Test {
void show(int a, float b) { }
void show(float a, int b) { }
public static void main(String[] args) {
Test t = new Test();
t.show(10, 10);
}
}
ANSWER: Compile-time Error
4.
class Test {
void show(int... a) { }
void show(int a) { }
public static void main(String[] args) {
Test t = new Test();
t.show(10);
}
}
ANSWER: show(int a)
5.
class Test {
void show(int a) { }
void show(int... a) { }
public static void main(String[] args) {
Test t = new Test();
t.show();
Discussion
Get the discussion rolling
A single comment can start something great.