Friday, March 30, 2007

Inheritance Mystery

1) Consider two methods overloaded as below

public String concatenate(String s)

public String concatenate(Object a)


and a call is made as concetenate(null), which method would be called?

----------------------------------------------

2) Consider two methods overloaded as below, where both Dog and Goat are extended from Object class.

public String concatenate(Dog s)
public String concatenate(Goat a)


and a call is made as concetenate(null), which method would be called?

No comments: