Java.lang.Package.hashCode() Method
Advertisements
Description
The java.lang.Package.hashCode() method returns the hash code computed from the package name.
Declaration
Following is the declaration for java.lang.Package.hashCode() method
public int hashCode()
Parameters
NA
Return Value
This method returns the hash code computed from the package name.
Exception
NA
Example
The following example shows the usage of lang.Object.hashCode() method.
package com.tutorialspoint;
public class PackageDemo {
public static void main(String[] args) {
// get the java lang package
Package pack = Package.getPackage("java.lang");
// print the hash code computed for this package
System.out.println("" + pack.hashCode());
}
}
Let us compile and run the above program, this will produce the following result:
-888658374