System.lineSeparator() in Java

System.lineSeparator(): This method is available in java.lang.System class of Java.

Syntax:

String java.lang.System.lineSeparator()

This method returns the system-dependent line separator string. It always returns the same value - the initial value of the system property line.separator.

Note:

1. On UNIX systems, it returns "\n".

2. On Microsoft Windows systems it returns "\r\n".

Returns: the system-dependent line separator string.

Approach

Java

public class SystemlineSeparator {
    public static void main(String[] args) {

        System.out.println(System.lineSeparator());
    }
}



No comments:

Post a Comment