GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.tutorialspoint.com — Java - Float floatValue() method
Selected Reading
Java - Float floatValue() methodDescriptionThe Java Float floatValue() method returns the float value of this Float object. DeclarationFollowing is the declaration for java.lang.Float.floatValue() method public float floatValue() ParametersNA Return ValueThis method returns the float value represented by this object. ExceptionNA Getting float Value from Float Object having Positive Value ExampleThe following example shows the usage of Float floatValue() method to get a float primitive value of given positive Float object. We've initialized a Float object with a given positive float value. Then using floatValue() method, we're printing its value. package com.tutorialspoint;
public class FloatDemo {
public static void main(String[] args) {
Float f = new Float("15.30");
//return the float value
System.out.println("Value = " + f.floatValue());
}
}
OutputLet us compile and run the above program, this will produce the following result − Value = 15.3 Getting float Value from Float Object having Negative Value ExampleThe following example shows the usage of Float floatValue() method to get a float primitive value of given negative Float object. We've initialized a Float object with a given negative float value. Then using floatValue() method, we're printing its value. package com.tutorialspoint;
public class FloatDemo {
public static void main(String[] args) {
Float f = new Float("-15.30");
//return the float value
System.out.println("Value = " + f.floatValue());
}
}
OutputLet us compile and run the above program, this will produce the following result − Value = -15.3 Getting float Value from Float Object having Negative Zero Value ExampleThe following example shows the usage of Float floatValue() method to get a float primitive value of given negative Float object of zero value. We've initialized a Float object with a given negative zero float value. Then using floatValue() method, we're printing its value. package com.tutorialspoint;
public class FloatDemo {
public static void main(String[] args) {
Float f = new Float("-0.0");
//return the float value
System.out.println("Value = " + f.floatValue());
}
}
OutputLet us compile and run the above program, this will produce the following result − Value = -0.0 Getting float Value from Float Object having Positive Zero Value ExampleThe following example shows the usage of Float floatValue() method to get a float primitive value of given positive Float object of zero value. We've initialized a Float object with a given positive zero float value. Then using floatValue() method, we're printing its value. package com.tutorialspoint;
public class FloatDemo {
public static void main(String[] args) {
Float f = new Float("+0.0");
//return the float value
System.out.println("Value = " + f.floatValue());
}
}
OutputLet us compile and run the above program, this will produce the following result − Value = 0.0 java_lang_float.htm
Advertisements
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |