javawriter

What is the difference between append and write methods of java.io.writer?


The java.io.Writer interface has two methods called append and write. What are the differences between these two? It even says that

An invocation of this method of the form out.append(c) behaves in exactly the same way as the invocation out.write(c)

so what is the reason for having two method name variants?


Solution

  • There are minor differences between append() and write(). All of which you can work out by reading the Javadocs. Hint. ;)

    write is an older style format created before CharSequence was available.

    These methods are overloaded so that there is a