---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 10 Edition"
java_version: 10
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/se10/html/jls-6.html#jls-6.5
id: "6.5"
url: https://jvm.obfuscated.software/jls/se10/6.5.html
raw: https://jvm.obfuscated.software/jls/se10/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 seven categories: *ModuleName*, *PackageName*, *TypeName*, *ExpressionName*, *MethodName*, *PackageOrTypeName*, or *AmbiguousName*.

  *TypeName* is less expressive than the other six categories, because it is denoted with *TypeIdentifier*, which excludes the character sequence `var` ([§3.8](3.8.md)).

- 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).

```
ModuleName:
  Identifier
  ModuleName . Identifier

PackageName:
  Identifier
  PackageName . Identifier

TypeName:
  TypeIdentifier
  PackageOrTypeName . TypeIdentifier

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 Module Names and 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)
