Java Package - isSealed() Method
The java.lang.Package.isSealed() method is used to check if this package is sealed. It returns true if this package is sealed, false otherwise.
Syntax
public boolean isSealed()
Parameters
No parameter is required.
Return Value
Returns true if the package is sealed, false otherwise.
Exception
NA.
Example:
In the example below, the java.lang.Package.isSealed() method is used to check if the given package is sealed or not.
import java.lang.*; public class MyClass { public static void main(String[] args) { //create a java util package object Package p = Package.getPackage("java.util"); //check if this package is sealed System.out.println("Is the package sealed?: " + p.isSealed()); } }
The output of the above code will be:
Is the package sealed?: true
❮ Java.lang - Package