Look at the documentation for
PrintWriter.
It has a method called print() which will print and stay at that line. So the next call to print() or println() will print on the same line.
Another method called println() will print and terminate that line. So the next call to print() or println() will automatically print on a new line.