I want to place a space instead of a new line in java, but how 🤔? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to place a space instead of a new line in java, but how 🤔?

What can i use so that my new line text should start from current line text end position. Like in python we use print(end="" ) but i don't in java what syntax is used? Thanks for advance🙂.

17th Dec 2021, 9:20 AM
Nitin Singh
Nitin Singh - avatar
3 Answers
+ 4
You just use the print() method instead of the println() method.
17th Dec 2021, 9:36 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
The simplest way to properly space your output in Java is by adding manual spacing. For instance, to output three different integers, "i," "j" and "k," with a space between each integer, use the following code: System.out.println(i + " " + j + " " + k);
17th Dec 2021, 9:31 AM
Neil Young
+ 2
TRANSCENDENCE WAVE , ChaoticDawg , Martin Taylor thanks guys, I got it. 🙌
17th Dec 2021, 10:11 AM
Nitin Singh
Nitin Singh - avatar