How do I get a platform-dependent new line character?

前端 未结 9 1331
予麋鹿
予麋鹿 2020-11-22 02:17

How do I get a platform-dependent newline in Java? I can’t use \"\\n\" everywhere.

9条回答
  •  一生所求
    2020-11-22 02:56

    This is also possible: String.format("%n").

    Or String.format("%n").intern() to save some bytes.

提交回复
热议问题