---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 24 Edition"
java_version: 24
chapter: "Chapter 6. Names"
section: "6"
heading: "Chapter 6. Names"
source: https://docs.oracle.com/javase/specs/jls/se24/html/jls-6.html
id: "6"
url: https://jvm.obfuscated.software/jls/se24/6.html
raw: https://jvm.obfuscated.software/jls/se24/6.md
---

# Chapter 6. Names

Names are used to refer to entities declared in a program.

A declared entity ([§6.1](6.1.md)) is a package, a class, an interface, a member (class, interface, field, or method) of a reference type, a type parameter, a formal parameter, an exception parameter, or a local variable.

Names in programs are either *simple*, consisting of a single identifier, or *qualified*, consisting of a sequence of identifiers separated by "`.`" tokens ([§6.2](6.2.md)).

Every declaration that introduces a name has a *scope* ([§6.3](6.3.md)), which is the part of the program text within which the declared entity can be referred to by a simple name.

A qualified name `N.x` may be used to refer to a *member* of a package or reference type, where `N` is a simple or qualified name and `x` is an identifier. If `N` names a package, then `x` is a member of that package, which is either a class, an interface, or a subpackage. If `N` names a reference type or a variable of a reference type, then `x` names a member of that type, which is either a class, an interface, a field, or a method.

In determining the meaning of a name ([§6.5](6.5.md)), the context of the occurrence is used to disambiguate among packages, types, variables, and methods with the same name.

Access control ([§6.6](6.6.md)) can be specified in a class, interface, method, or field declaration to control when *access* to a member is allowed. Access is a different concept from scope. Access specifies the part of the program text within which the declared entity can be referred to by a qualified name. Access to a declared entity is also relevant in a field access expression ([§15.11](15.11.md)), a method invocation expression in which the method is not specified by a simple name ([§15.12](15.12.md)), a method reference expression ([§15.13](15.13.md)), or a qualified class instance creation expression ([§15.9](15.9.md)). In the absence of an access modifier, most declarations have package access, allowing access anywhere within the package that contains its declaration; other possibilities are `public`, `protected`, and `private`.

Fully qualified and canonical names ([§6.7](6.7.md)) are also discussed in this chapter.

**Sections:**

- [6.1. Declarations](6.1.md)
- [6.2. Names and Identifiers](6.2.md)
- [6.3. Scope of a Declaration](6.3.md)
- [6.4. Shadowing and Obscuring](6.4.md)
- [6.5. Determining the Meaning of a Name](6.5.md)
- [6.6. Access Control](6.6.md)
- [6.7. Fully Qualified Names and Canonical Names](6.7.md)
