Percent Symbol(%) at End for System.out.print() Output in Java

Last updated on 11 Sep, 2022

We have a Java code that prints "apple" in terminal.


In your terminal you might see the output with a percent symbol attached. Why?

Ending percent

This extra percent symbol is added by zsh terminal. When (non-null) output from a program doesn't include a trailing newline, zsh adds that color-inverted % to indicate that and moves to the next line before printing the prompt.

If the next command prompt is displayed along with the output as shown below it will be awkward and difficult to read.

appleprojects >

Instead zsh notifies the developer about the absense of trailing new line using the % and then move the prompt to next line.