Return | Method | Summary |
---|---|---|
byte | byteValue() | Returns a byte (by casting to a byte). |
double | doubleValue() | Returns the double value of this Double object. |
float | floatValue() | Returns the float value of this Double object. |
int | intValue() | Returns the value of this Double as an int (by casting to type int). |
long | longValue() | Returns the value of this Double as a long (by casting to type long). |
short | shortValue() | Returns the value of this Double as a short (by casting to a short). |
public class Main {
public static void main(String[] args) {
Double doubleObject = new Double("10.01");
byte b = doubleObject.byteValue();
System.out.println("byte:"+b);
short s = doubleObject.shortValue();
System.out.println("short:"+s);
int i = doubleObject.intValue();
System.out.println("int:"+i);
float f = doubleObject.floatValue();
System.out.println("float"+f);
double d = doubleObject.doubleValue();
System.out.println("double:"+d);
long l = doubleObject.longValue();
System.out.println("long:"+l);
}
}
The output:
byte:10
short:10
int:10
float10.01
double:10.01
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. |