Float Datatype Example Java Program


Definition

Float is a keyword which designates the 32 bit float primitive type. The java.lang.Float class is the nominal wrapper class when you need to store a float value but an object reference is required.

Syntax

float  = ;

Float Datatype Example Program

class FloatDatatype{
	public static void main(String[] args){
		float a=22.8f;
		float b=100.0f;
		System.out.println(""+a);
		System.out.println(""+b);
	}
}

Sample Output

Output is:
22.8f
100.0f