【问题标题】:java - How to make the list go beside each other (horizontally) instead of going down (vertically).java - 如何使列表彼此并排(水平)而不是向下(垂直)。
【发布时间】:2013-08-06 11:45:38
【问题描述】:

如何使列表并排(水平)而不是向下(垂直)。

例子:

一月(这是我不断得到的) S M T W T F S 1

2

3

4

5

...

一月(这是我想要的) S M T W T F S 1 2 3 4 5 6 7 8 9 ...

感谢任何帮助,我是新手,我无法弄清楚。 :)

【问题讨论】:

    标签: java alignment horizontallist


    【解决方案1】:

    使用:

    System.out.print("Value");
    

    而不是:

    System.out.println("Value");
    

    别忘了加一个

    System.out.println(""); 
    

    最后刷新缓冲区。

    【讨论】:

    • 您还需要一个换行符来刷新缓冲区以使其实际打印。
    • 很多人似乎不知道无参数System.out.println() 方法...
    • @bcsb1001 无参数方法有什么用?打印一个空行?
    • @Simon 是的,即与您所做的 System.out.println("") 完全相同,但更短更清晰。
    • @bcsb1001 确实更短,但我认为更清晰。仍然感谢您提供的信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-08
    • 2019-06-29
    • 2016-11-21
    • 1970-01-01
    • 1970-01-01
    • 2019-02-27
    • 1970-01-01
    相关资源
    最近更新 更多