java初学者为什么我编写的 在一行上

2025-05-06 09:16:02
推荐回答(5个)
回答1:

因为你的输出语句没有加ln
例如 你写的的输出语句肯定是这样的
System.out.print("ok");
System.out.print("hello");
System.out.print("37");

你可以写成
System.out.println("ok");
System.out.println("hello");
System.out.println("37");
这样就不会在一行上了, 祝你学习进步

回答2:

你用的 System.out.print("123");把,这个是不换行的

System.out.println("123"); 这个是换行的

一个是print,一个println

回答3:

换行是println();

猜想您是这样打,print("ok"); print("hello"); print(37);

要嘛换行,要嘛逐字加空白。

回答4:

java中System.out.println打印并换行,System.out.print打印但不换行

回答5:

ln换行就好 还有 建议 在eclipse中编写