
how to show all the decimal places in a double value?

Here is an example of double datatype to show some of its possible decimal values.
import java.text.*;
class ShowDecimalPlaces
{
public static void main(String[] args)
{
double d=345.678;
DecimalFormat df=new DecimalFormat();
df.applyPattern("#0.00000");
System.out.println(df.format(d));
df.applyPattern("#0.0000");
System.out.println(df.format(d));
df.applyPattern("#0.000");
System.out.println(df.format(d));
df.applyPattern("#0.00");
System.out.println(df.format(d));
df.applyPattern("#0.0");
System.out.println(df.format(d));
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.