public class Test
{
public void method1(Object o)
{
System.out.print("object");
}
public void method1(String s)
{
System.out.print("string");
}
public static void main(String[] args)
{
Test t = new Test();
t.method1(null);
}
}
When running the program, the output would be
(a) object
(b) string
(c) objectstring
(d) stringobject
Answer:
(b) string
Explanation:
It is the hierarchy of objects being searched for a match, which is quite similar to the exception objects of catch blocks. The search process is done in the bottom-up manner wherein the object of class of least node is searched first and its continued upwards to the super/parent classes till the end is reached.
3 comments:
Hi,
Techincal :P Enaku romba thooram ;)?
Bytheway there is a tag in my blog. I felt you might be interested 2 write the tag :)
Pls have a look and feel free 2 ignore if you are not interested to write :)
@Ponnarasi,
Thanks for visiting and commenting! Nice to hear that you are away from the technical which we can't ;-(!
lemme have a look and try!
Take Care.
But you can visit other blogs of mine.. he he he..
Kewl Explanation. !!
Post a Comment