---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 9 Edition"
java_version: 9
chapter: "Chapter 3. Lexical Structure"
section: "3.4"
heading: "3.4. Line Terminators"
parent: "Chapter 3. Lexical Structure"
source: https://docs.oracle.com/javase/specs/jls/se9/html/jls-3.html#jls-3.4
id: "3.4"
url: https://jvm.obfuscated.software/jls/se9/3.4.html
raw: https://jvm.obfuscated.software/jls/se9/3.4.md
---

# 3.4. Line Terminators

A Java compiler next divides the sequence of Unicode input characters into lines by recognizing *line terminators*.

```
LineTerminator:
  the ASCII LF character, also known as "newline"
  the ASCII CR character, also known as "return"
  the ASCII CR character followed by the ASCII LF character

InputCharacter:
  UnicodeInputCharacter but not CR or LF
```

Lines are terminated by the ASCII characters CR, or LF, or CR LF. The two characters CR immediately followed by LF are counted as one line terminator, not two.

A line terminator specifies the termination of the `//` form of a comment ([§3.7](3.7.md)).

The lines defined by line terminators may determine the line numbers produced by a Java compiler.

The result is a sequence of line terminators and input characters, which are the terminal symbols for the third step in the tokenization process.
