To store a number with a fraction we can use floating type.

There are two types. Like,

float : Single precision can store 32 bits

double : Double precisions can store 64 bits

You should type f after the float value, and should type d after the double value.


package variables.Variables;

public class TheFloating {

    public static void main(String[] args) {

        int iNumber = 5;

        float fNumber = 5.55f;

        double dNumber = 20.75d;

        System.out.println(iNumber);
        System.out.println(fNumber);
        System.out.println(dNumber);
    }
}