Java Short intValue Example
Short class intValue method example. This example shows you how to use intValue method.
Short class intValue method example. This example shows you how to use intValue method. Method returns int value of specified Short Object.
Here is the code.
/**
/** @(#) IntValueShort.java
* A class representing use of method intValue() of Short class in java.lang Package.
* @Version 03-May-2008
* @author Rose India Team
*/
class IntValueShort{
public static void main(String[] args){
short shortNum1 = 123, shortNum2 = 321;
Short ShortObj1 = new Short(shortNum1);
Short ShortObj2 = new Short(shortNum2);
//Method returns int value of this Short Object.
int intValue = ShortObj1.intValue();
System.out.println("int value for this Short ShortObj1 is : " + intValue);
//Method returns int value of this Short Object.
intValue = ShortObj2.intValue();
System.out.println("int value for this Short ShortObj1 is : " + intValue);
}
} |
|