Java Short.hashCode()

Syntax

Short.hashCode() has the following syntax.

public int hashCode()

Example

In the following code shows how to use Short.hashCode() method.


public class Main{
/*from   ww  w. jav  a 2s  . c  o m*/
   public static void main(String[] args) {
     short shortNum1 = 150;
     Short ShortObj1 = new Short(shortNum1);
  
     int hcode = ShortObj1.hashCode(); 
     System.out.println("Hashcode for this Short ShortObj1 = " + hcode);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable