Search code examples
javaalignmenthorizontallist

java - How to make the list go beside each other (horizontally) instead of going down (vertically).


how do I make the list go beside each other (horizontally) instead of going down (vertically).

Example:

January (this is what I keep getting) S M T W T F S 1

2

3

4

5

...

January (this is what I wanted to get) S M T W T F S 1 2 3 4 5 6 7 8 9 ...

Thanks any help would be appreciated, I'm new at this and I can't figure it out. :)


Solution

  • Use :

    System.out.print("Value");
    

    instead of :

    System.out.println("Value");
    

    And don't forget to add a

    System.out.println(""); 
    

    at the end to flush the buffer.