Java.lang.Package.isSealed() Method



Description

The java.lang.Package.isSealed() method returns true if this package is sealed..

Declaration

Following is the declaration for java.lang.Package.isSealed() method

public boolean isSealed()

Parameters

NA

Return Value

This method returns true if the package is sealed, false otherwise

Exception

NA

Example

The following example shows the usage of lang.Object.isSealed() method.

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
java_lang_package.htm
Advertisements