Java Float(String s) Constructor

Syntax

Float(String s) constructor from Float has the following syntax.

public Float(String s)  throws NumberFormatException

Example

In the following code shows how to use Float.Float(String s) constructor.


public class Main {
  public static void main(String[] args) {
/*from   w w w  .  j  a  v  a2  s.c om*/
    Float float3 = new Float("0.2");
    
    System.out.println(float3);
    
  }
}

The output:





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable