Java.lang.Package Class

Java Package Class

The Package class in the Java.lang.Package gives version information about a Java package’s implementation and specification.

Class declaration

The declaration of java.lang.Package class is:

 

public class Package 
 extends Object 
   implements AnnotatedElement

Java.lang.Package Methods

The java.lang.Package class has a number of methods which are listed below:

 

Member Methods

S.N Methods & Description
1. String getName()
Return the name of this package.
2. String getImplementationTitle()
Return the title of this package.
3. String getImplementationVendor()
Returns the name of the organization, vendor or company that provided this implementation.
4. String getImplementationVersion()
Return the version of this implementation.
5. static Package getPackage(String name)
Find a package by name in the callers ClassLoader instance.
6. static Package[] getPackages()
Get all the packages currently known for the caller’s ClassLoader instance.
7. String getSpecificationTitle()
Return the title of the specification that this package implements.
8. String getSpecificationVendor()
Return the name of the organization, vendor, or company that owns and maintains the specification of the classes that implement this package.
9. String getSpecificationVersion()
Returns the version number of the specification that this package implements.
10. int hashCode()
Return the hash code computed from the package name.
11. boolean isCompatibleWith(String desired)
Compare this package’s specification version with a desired version.
12. boolean isSealed()
Returns true if this package is sealed.
13. String toString()
Returns the string representation of this Package.

Methods inherited by Java.lang.Package

This class inherits the methods of the following class:

  • java.lang.Object

 

To open the online compiler click here.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *