Java.lang.Package.isSealed() Method



Description

The java.lang.Package.isSealed(URL url) method true if this package is sealed with respect to the specified code source url.

Declaration

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

public boolean isSealed(URL url)

Parameters

url − the code source url

Return Value

This method returns true if this package is sealed with respect to url

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) {
      try {
         // get the java lang package
         Package pack = Package.getPackage("java.lang");

         // check if this package is sealed
         URL url = new URL("http://www.tutorialspoint.com");
         System.out.println("" + pack.isSealed(url));
      } catch (MalformedURLException ex) {
         ex.printStackTrace();
      }
   }
}

Let us compile and run the above program, this will produce the following result −

false
java_lang_package.htm
Advertisements