public String getPackageName ()

Returns the fully qualified package name.

If this class is a top level class, then this method returns the fully qualified name of the package that the class is a member of, or the empty string if the class is in an unnamed package.

If this class is a member class, then this method is equivalent to invoking getPackageName() on the enclosing class.

If this class is a local class or an anonymous class, then this method is equivalent to invoking getPackageName() on the declaring class of the enclosing method or enclosing constructor.

If this class represents an array type then this method returns the package name of the element type. If this class represents a primitive type or void then the package name " java.lang" is returned.

Returns:  the fully qualified package name

Since:  9

@spec JPMS
@jls 6.7 Fully Qualified Names