Java Package Class
Introduction
The Java Package class contain version information about the implementation and specification of a Java package
Class Declaration
Following is the declaration for java.lang.Package class −
public class Package
extends Object
implements AnnotatedElement
Class methods
Methods inherited
This class inherits methods from the following classes −
- java.lang.Object
Checking a Package being Sealed Example
The following example shows the usage of lang.Object.isSealed() method. In this program, we've checked the java.lang package being sealed or not using isSealed() method and result is printed as false.
package com.tutorialspoint;
public class PackageDemo {
public static void main(String[] args) {
// get the java lang package
Package pack = Package.getPackage("java.lang");
// check if this package is sealed
System.out.println("" + pack.isSealed());
}
}
Let us compile and run the above program, this will produce the following result −
false