Home » Java programming language

Java Package isSealed() method with example

Package Class isSealed() method: Here, we are going to learn about the isSealed() method of Package Class with its syntax and example.
Submitted by Preeti Jain, on December 04, 2019

Package Class isSealed() method

  • isSealed() method is available in java.lang package.
  • isSealed() method is used to check whether this package is sealed or not sealed.
  • isSealed() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
  • isSealed() method does not throw an exception at the time of the sealing package.


    public boolean isSealed();


  • It does not accept any parameter.

Return value:

The return type of this method is boolean, it returns the following values based on the given cases,

  • It returns true when this package is sealed.
  • It returns false when this package is not sealed.


// Java program to demonstrate the example 
// of boolean isSealed() method of Package 

public class IsSealed {
    public static void main(String[] args) {
        // Get Package by using getPackage() method
        Package pkg = Package.getPackage("java.util");

        // By using isSealed() method is to check 
        //whether this package is sealed or not
        boolean seal_status = pkg.isSealed();

        // Display sealed status of the package
        System.out.println("pkg.isSealed() = " + seal_status);


pkg.isSealed() = true


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.