Return | Method | Summary |
---|---|---|
byte | byteValue() | Returns the value of this Short as a byte. |
double | doubleValue() | Returns the value of this Short as a double. |
float | floatValue() | Returns the value of this Short as a float. |
int | intValue() | Returns the value of this Short as an int. |
long | longValue() | Returns the value of this Short as a long. |
short | shortValue() | Returns the value of this Short as a short. |
public class Main {
public static void main(String[] args) {
Short shortObject = new Short("10");
byte b = shortObject.byteValue();
System.out.println("byte:"+b);
short s = shortObject.shortValue();
System.out.println("short:"+s);
int i = shortObject.intValue();
System.out.println("int:"+i);
float f = shortObject.floatValue();
System.out.println("float"+f);
double d = shortObject.doubleValue();
System.out.println("double:"+d);
long l = shortObject.longValue();
System.out.println("long:"+l);
}
}
The output:
byte:10
short:10
int:10
float10.0
double:10.0
long:10
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |