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

# 6.5.4. Meaning of PackageOrTypeNames

## 6.5.4.1. Simple PackageOrTypeNames

If the *PackageOrTypeName*, `Q`, is a valid *TypeIdentifier* and occurs in the scope of a class, interface, or type parameter named `Q`, then the *PackageOrTypeName* is reclassified as a *TypeName*.

Otherwise, the *PackageOrTypeName* is reclassified as a *PackageName*. The meaning of the *PackageOrTypeName* is the meaning of the reclassified name.

## 6.5.4.2. Qualified PackageOrTypeNames

Given a qualified *PackageOrTypeName* of the form `Q.Id`, if `Id` is a valid *TypeIdentifier* and the class, interface, type parameter, or package denoted by `Q` has a member class or interface named `Id`, then the qualified *PackageOrTypeName* name is reclassified as a *TypeName*.

Otherwise, it is reclassified as a *PackageName*. The meaning of the qualified *PackageOrTypeName* is the meaning of the reclassified name.
