- Java.lang Package classes
- Java.lang - Home
- Java.lang - Boolean
- Java.lang - Byte
- Java.lang - Character
- Java.lang - Character.Subset
- Java.lang - Character.UnicodeBlock
- Java.lang - Class
- Java.lang - ClassLoader
- Java.lang - Compiler
- Java.lang - Double
- Java.lang - Enum
- Java.lang - Float
- Java.lang - InheritableThreadLocal
- Java.lang - Integer
- Java.lang - Long
- Java.lang - Math
- Java.lang - Number
- Java.lang - Object
- Java.lang - Package
- Java.lang - Process
- Java.lang - ProcessBuilder
- Java.lang - Runtime
- Java.lang - RuntimePermission
- Java.lang - SecurityManager
- Java.lang - Short
- Java.lang - StackTraceElement
- Java.lang - StrictMath
- Java.lang - String
- Java.lang - StringBuffer
- Java.lang - StringBuilder
- Java.lang - System
- Java.lang - Thread
- Java.lang - ThreadGroup
- Java.lang - ThreadLocal
- Java.lang - Throwable
- Java.lang - Void
- Java.lang Package extras
- Java.lang - Interfaces
- Java.lang - Errors
- Java.lang - Exceptions
- Java.lang Package Useful Resources
- Java.lang - Useful Resources
- Java.lang - Discussion
Java Package isSealed() Method
Description
The Java 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
Checking a java.lang Package being Sealed Example
The following example shows the usage of java.lang.Package.isSealed() method. In this program, we've created a Package variable and assigned it java.lang package object. Next we've created a URL object with http://www.tutorialspoint.com". Then using isSealed() method, we're checking if package is sealed or not with respect to the given URL.
package com.tutorialspoint; import java.net.MalformedURLException; import java.net.URL; 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(); } } }
Output
Let us compile and run the above program, this will produce the following result −
false
Checking a com.tutorialspoint Package being Sealed Example
The following example shows the usage of java.lang.Package.isSealed() method. In this program, we've created a Package variable and assigned it com.tutorialspoint package object. Next we've created a URL object with http://www.tutorialspoint.com". Then using isSealed() method, we're checking if package is sealed or not with respect to the given URL.
package com.tutorialspoint; import java.net.MalformedURLException; import java.net.URL; public class PackageDemo { public static void main(String[] args) { try { // get the java lang package Package pack = Package.getPackage("com.tutorialspoint"); // 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(); } } }
Output
Let us compile and run the above program, this will produce the following result −
false
Checking a java.util Package being Sealed Example
The following example shows the usage of java.lang.Package.isSealed() method. In this program, we've created a Package variable and assigned it java.util package object. Next we've created a URL object with http://www.tutorialspoint.com". Then using isSealed() method, we're checking if package is sealed or not with respect to the given URL.
package com.tutorialspoint; import java.net.MalformedURLException; import java.net.URL; public class PackageDemo { public static void main(String[] args) { try { // get the java util package Package pack = Package.getPackage("java.util"); // 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(); } } }
Output
Let us compile and run the above program, this will produce the following result −
false