Primitive Data Types – Float

Primitive Data Types in Java – Float

Primitive data types are very important in any language. Without this data types we can not understand programming language. We can also called primary data types in java. In this primitive data types we found four types of family like Integer, Float, Character and Boolean. And these families have their own children like Integer [byte, short, int and long], Float [float, double], Character [char] and Boolean [Boolean].

In this blog we will discuss on Float Family:

Float Data Type

NoData TypesSizeRang
1float4 byteMore than Integer
2double 8 byteMore than float
3long double 10 byteMaximum in Java

 

Program in Float Data Types:

Title: Primary Data Type – Float

class data2

{

public static void main(String args[])

{

//float f1 = (float)67.78; // Cast this value into double
float f1 = 67.78f; // Cast this value into double

System.out.println(“F1 = ” + f1);

double d1 = 67.89;

System.out.println(“D1 = ” + d1);

}

}

Output:

67.78

67.89

 

Video available on YouTube

 

 

Tutorial – Try Yourself

Tutorial – 1 : Find the area of circle.

Tutorial – 2 : Find sum and average of 6 numbers.

 

[sbscrbr_form]

If you have problem on this blog, you can directly comment or subscribe.

Primitive Integer | Primitive Character

878total visits,7visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image