01. public class Test {
02.
03. public long add(long x, int y) {
04. return x + y;
05. }
06.
07. public static void main(String[] args) {
08. byte x = 5;
09. int y = 6;
10. Test t = new Test();
11. t.add(5, 6);
12. }
13. }
which of the following methods can legally added to class Test?
the options:-
a.public long add(int x, long y) {return x + y;}
b.public int add(int x, int y) {return x + y;}
c.public byte add(byte x, byte y) {return x + y;}
d.public int add(int x, byte y) {return x + y;}
e.public short add(byte x, int y) {return x + y;}
the answers given is b and d.
this is given in
http://www.aniyog.com/java/certification/java_mock_test.htm. But when I compiled and executed this all options were correct.
I think the answers given is worng.
plz someone help me on this confusion to get resolved....
Thanks in advance.