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 class with Examples
Selected Reading
Java - Float class with ExamplesIntroductionThe Java Float class wraps a value of primitive type float in an object. An object of type Float contains a single field whose type is float. Class DeclarationFollowing is the declaration for java.lang.Float class − public final class Float
extends Number
implements Comparable<Float>
FieldFollowing are the fields for java.lang.Float class −
Class constructors
Class methods
Methods inheritedThis class inherits methods from the following classes −
ExampleThe following example shows the usage of Float class to get float from a string. package com.tutorialspoint;
public class FloatDemo {
public static void main(String[] args) {
// create a String s and assign value to it
String s = "+120";
// create a Float object f
Float f;
// get the value of float from string
f = Float.valueOf(s);
// print the value
System.out.println( "Float value of string " + s + " is " + f );
}
}
Let us compile and run the above program, this will produce the following result − Float value of string +120 is 120.0 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. |