- Java.lang - Void
- Java.lang - Throwable
- Java.lang - ThreadLocal
- Java.lang - ThreadGroup
- Java.lang - Thread
- Java.lang - System
- Java.lang - StringBuilder
- Java.lang - StringBuffer
- Java.lang - String
- Java.lang - StrictMath
- Java.lang - StackTraceElement
- Java.lang - Short
- Java.lang - SecurityManager
- Java.lang - RuntimePermission
- Java.lang - Runtime
- Java.lang - ProcessBuilder
- Java.lang - Process
- Java.lang - Package
- Java.lang - Object
- Java.lang - Number
- Java.lang - Math
- Java.lang - Long
- Java.lang - Integer
- Java.lang - InheritableThreadLocal
- Java.lang - Float
- Java.lang - Enum
- Java.lang - Double
- Java.lang - Compiler
- Java.lang - ClassLoader
- Java.lang - Class
- Java.lang - Character.UnicodeBlock
- Java.lang - Character.Subset
- Java.lang - Character
- Java.lang - Byte
- Java.lang - Boolean
- Java.lang - Home
Java.lang Package extras
Java.lang Package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.lang.Float Class
Introduction
The java.lang.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 Declaration
Following is the declaration for java.lang.Float class −
pubpc final class Float extends Number implements Comparable<Float>
Field
Following are the fields for java.lang.Float class −
static int MAX_EXPONENT − This is Maximum exponent a finite float variable may have.
static float MAX_VALUE − This is a constant holding the largest positive finite value of type float, (2-2-23)·2127.
static int MIN_EXPONENT − This is minimum exponent a normapzed float variable may have.
static float MIN_NORMAL − This is a constant holding the smallest positive normal value of type float, 2-126.
static float MIN_VALUE − This is a constant holding the smallest positive nonzero value of type float, 2-149.
static float NaN − This is a constant holding a Not-a-Number (NaN) value of type float.
static float NEGATIVE_INFINITY − This is a constant holding the negative infinity of type float.
static float POSITIVE_INFINITY − This is a constant holding the positive infinity of type float.
static int SIZE − This is the number of bits used to represent a float value.
static Class<Float> TYPE − This is the Class instance representing the primitive type float.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 |
Float(double value) This constructs a newly allocated Float object that represents the argument converted to type float. |
2 |
Float(float value) This constructs a newly allocated Float object that represents the primitive float argument. |
3 |
Float(String s) This constructs a newly allocated Float object that represents the floating-point value of type float represented by the string. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method returns the value of this Float as a byte (by casting to a byte). |
2 | This method compares the two specified float values. |
3 | This method compares two Float objects numerically. |
4 | This method returns the double value of this Float object. |
5 | This method compares this object against the specified object. |
6 | This method returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout. |
7 | This method returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values. |
8 | This method returns the float value of this Float object. |
9 | This method returns a hash code for this Float object. |
10 | This method returns the float value corresponding to a given bit representation. |
11 | This method returns the value of this Float as an int (by casting to type int). |
12 | This method returns true if this Float value is infinitely large in magnitude, false otherwise. |
13 | This method returns true if the specified number is infinitely large in magnitude, false otherwise. |
14 | This method returns true if this Float value is a Not-a-Number (NaN), false otherwise. |
15 | This method returns true if the specified number is a Not-a-Number (NaN) value, false otherwise. |
16 | This method returns value of this Float as a long (by casting to type long). |
17 | This method returns a new float initiapzed to the value represented by the specified String, as performed by the valueOf method of class Float. |
18 | This method returns the value of this Float as a short (by casting to a short). |
19 | This method returns a hexadecimal string representation of the float argument. |
20 | This method returns a string representation of this Float object. |
21 | This method returns a string representation of the float argument |
22 | This method returns a Float instance representing the specified float value. |
23 | This method returns a Float object holding the float value represented by the argument string s. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object