---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 8 Edition"
java_version: 8
chapter: "Chapter 6. Names"
section: "6.5"
heading: "6.5. Determining the Meaning of a Name"
parent: "Chapter 6. Names"
source: https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.5
id: "6.5"
url: https://jvm.obfuscated.software/jls/se8/6.5.html
raw: https://jvm.obfuscated.software/jls/se8/6.5.md
---

# 6.5. Determining the Meaning of a Name

The meaning of a name depends on the context in which it is used. The determination of the meaning of a name requires three steps:

- First, context causes a name syntactically to fall into one of six categories: *PackageName*, *TypeName*, *ExpressionName*, *MethodName*, *PackageOrTypeName*, or *AmbiguousName*.
- Second, a name that is initially classified by its context as an *AmbiguousName* or as a *PackageOrTypeName* is then reclassified to be a *PackageName*, *TypeName*, or *ExpressionName*.
- Third, the resulting category then dictates the final determination of the meaning of the name (or a compile-time error if the name has no meaning).

```
PackageName:
  Identifier
  PackageName . Identifier

TypeName:
  Identifier
  PackageOrTypeName . Identifier

PackageOrTypeName:
  Identifier
  PackageOrTypeName . Identifier

ExpressionName:
  Identifier
  AmbiguousName . Identifier

MethodName:
  Identifier

AmbiguousName:
  Identifier
  AmbiguousName . Identifier
```

The use of context helps to minimize name conflicts between entities of different kinds. Such conflicts will be rare if the naming conventions described in [§6.1](6.1.md) are followed. Nevertheless, conflicts may arise unintentionally as types developed by different programmers or different organizations evolve. For example, types, methods, and fields may have the same name. It is always possible to distinguish between a method and a field with the same name, since the context of a use always tells whether a method is intended.

**Sections:**

- [6.5.1. Syntactic Classification of a Name According to Context](6.5.1.md)
- [6.5.2. Reclassification of Contextually Ambiguous Names](6.5.2.md)
- [6.5.3. Meaning of Package Names](6.5.3.md)
- [6.5.4. Meaning of PackageOrTypeNames](6.5.4.md)
- [6.5.5. Meaning of Type Names](6.5.5.md)
- [6.5.6. Meaning of Expression Names](6.5.6.md)
- [6.5.7. Meaning of Method Names](6.5.7.md)
