There are many ways to print new line in string been illustrated as below:
Using System. lineSeparator() method.Using platform-dependent newline character.Using System. getProperty() method.Using %n newline character.Using System. out. println() method.
What does += mean in Java?
The addition assignment operator ( += ) adds the value of the right operand to a variable and assigns the result to the variable. The types of the two operands determine the behavior of the addition assignment operator.
What does %d mean in Java?
The %d specifies that the single variable is a decimal integer. The %n is a platform-independent newline character. The output is: The value of i is: 461012. The printf and format methods are overloaded.