To get a platform-dependent new line character in Java, you can use the System.lineSeparator() method.