Ankur kothari wrote:but does in this case..stringbuffer doesnt have 2 append methods
Ankur kothari wrote:
s.append(null) gives me some ambiguous error? can anyone explain why?
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Ankur kothari wrote:oh so there is an ambiguous call between append(String) and append(Object)....but since string is more specific...so isnt append(String) called?
Ankur kothari wrote:
[code deleted]
this is the order i think in which the methods are called......what does this mean? isnt the "null" be returned?
Henry Wong wrote:
What about append() with charsequence, string buffer, or char array? Can't those also take null? Give those five append() methods, which one is the most specific?
Henry
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Ankur kothari wrote:well the compiler shows that ambiguity is between stringbuffer and string methods
Henry Wong wrote:
Ankur kothari wrote:well the compiler shows that ambiguity is between stringbuffer and string methods
Yes, because that is what the compiler found. It doesn't mean there are no more ambiguous methods. Both String and char array subclass from Object, that is just as ambiguous. etc.
Henry
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Minhaj kaimkhani wrote:Ok! but its still not clear to me, the main question is:
why compiler dont complaining ambiguity between all of the 5 methods??![]()
money grubbing section goes here:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
|