I've inherited some Java. I have lots of experience with other C-like languages, but I'm still fairly new to Java. In one function, my predecessor has used both the write()
and append()
methods of the Writer
class, but I can't figure out why. And more generally, I can't figure out why both methods exist, because Oracle's doc says, An invocation of this method of the form out.append(c)
behaves in exactly the same way as the invocation out.write(c)
. Why do both methods exist? Do I need to care?
Because its authors decided to make Writer
implement the interface Appendable
.