Page 1 of 1

About Question enthuware.ocpjp.v7.2.1736 :

Posted: Sat Jun 13, 2015 1:13 am
by rocky_bgta
if I change the declaration as:

Code: Select all

int a = 10;
		Integer[] aa = { 10, 20 };
		long l = 30;

		probe(a);
		probe(aa);
		probe(l); 
it produce output as:
In Integer
In Integer..
In Long

but my question is why probe(aa) print: In Integer..
while it can also print: In Object
as

Code: Select all

int[]aa = {10, 20} 
declaration because

Code: Select all

Integer[]aa
"aa" is also object.

Re: About Question enthuware.ocpjp.v7.2.1736 :

Posted: Sat Jun 13, 2015 1:47 am
by admin
Because the parameter that matches more precisely is the one that is selected. aa does match Object but it matches more closely to Integer[].
You will read about it in explanations of other questions where this concept is tested.
HTH,
Paul.