Is there any difference between %n and \n ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 9

Is there any difference between %n and \n ?

As I remember official documentation suggest us to use %n instead of \n. Can anyone explain why?

12th Feb 2019, 2:48 PM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar
2 Réponses
+ 5
Now it's clear. The %n is platform-independent newline character. Original source: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
12th Feb 2019, 3:51 PM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar