Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Java package name be a keyword?

When I try to create a package implements using Intellij (community edition) I got message Not a valid package name. Is this because of the keyword being used?

enter image description here

like image 876
Bala Avatar asked Apr 23 '14 17:04

Bala


1 Answers

Is this because of the keyword being used?

Yes, a package name has the following form

PackageDeclaration:
    {PackageModifier} package Identifier {. Identifier} ;

where Identifier is

Identifier:
    IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
IdentifierChars:
    JavaLetter {JavaLetterOrDigit}
JavaLetter:
    any Unicode character that is a "Java letter"
JavaLetterOrDigit:
    any Unicode character that is a "Java letter-or-digit"

So keywords cannot be used.

like image 182
Sotirios Delimanolis Avatar answered Sep 21 '22 19:09

Sotirios Delimanolis