---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 23 Edition"
java_version: 23
chapter: "Chapter 4. The class File Format"
section: "4.7.12"
heading: "4.7.12. The LineNumberTable Attribute"
parent: "4.7. Attributes"
source: https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-4.html#jvms-4.7.12
id: "4.7.12"
url: https://jvm.obfuscated.software/jvms/se23/4.7.12.html
raw: https://jvm.obfuscated.software/jvms/se23/4.7.12.md
---

# 4.7.12. The `LineNumberTable` Attribute

The `LineNumberTable` attribute is an optional variable-length attribute in the `attributes` table of a `Code` attribute ([§4.7.3](4.7.3.md)). It may be used by debuggers to determine which part of the `code` array corresponds to a given line number in the original source file.

If multiple `LineNumberTable` attributes are present in the `attributes` table of a `Code` attribute, then they may appear in any order.

There may be more than one `LineNumberTable` attribute *per line of a source file* in the `attributes` table of a `Code` attribute. That is, `LineNumberTable` attributes may together represent a given line of a source file, and need not be one-to-one with source lines.

The `LineNumberTable` attribute has the following format:

```
LineNumberTable_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 line_number_table_length;
    {   u2 start_pc;
        u2 line_number;
    } line_number_table[line_number_table_length];
}
```

The items of the `LineNumberTable_attribute` structure are as follows:

- **attribute_name_index**

  The value of the `attribute_name_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_Utf8_info` structure ([§4.4.7](4.4.7.md)) representing the string "`LineNumberTable`".

- **attribute_length**

  The value of the `attribute_length` item indicates the length of the attribute, excluding the initial six bytes.

- **line_number_table_length**

  The value of the `line_number_table_length` item indicates the number of entries in the `line_number_table` array.

- **line_number_table[]**

  Each entry in the `line_number_table` array indicates that the line number in the original source file changes at a given point in the `code` array. Each `line_number_table` entry must contain the following two items:

  - **start_pc**

    The value of the `start_pc` item must be a valid index into the `code` array of this `Code` attribute. The item indicates the index into the `code` array at which the code for a new line in the original source file begins.

  - **line_number**

    The value of the `line_number` item gives the corresponding line number in the original source file.
