How to get a platform-dependent new line character in Java

1 Answer

0 votes
public class MyClass {

    public static void main(String args[]) {
        String newLine = System.lineSeparator();
        
        System.out.println("java c c++" + newLine + "php go python");
    }
}
        
        
        
        
/*
run:
        
java c c++
php go python

*/

 



answered Oct 7, 2023 by avibootz

Related questions

2 answers 404 views
1 answer 255 views
1 answer 267 views
1 answer 304 views
...