Print multiple lines output in java without using a new line character

前端 未结 9 1972
轮回少年
轮回少年 2020-12-18 15:40

this is one of the interview question. I am supposed to print multiple lines of output on command line, without using the newline(\\n) character in java. I trie

9条回答
  •  执笔经年
    2020-12-18 16:14

    Ok, now I think I understand your question. What about this?

    println(String.format("%d%n%d%n%d%n%d%n%d%n", 1, 2, 3, 4, 5));
    

提交回复
热议问题