Thursday, August 13, 2020

write a java program for bigdecimal?

 import java.math.*;

class FloatTy 

{

public static void main(String[] args) 

{

float v1=12.3f;

System.out.println(v1);

double v2=12.3;

        System.out.println(v2);

System.out.println("0.1f == 0.1 is " + (0.1f == 0.1));

        System.out.println("0.1f is actually " + new BigDecimal(0.1f));

        System.out.println("0.1 is actually " + new BigDecimal(0.1));

}

}


No comments:

Post a Comment