A double value always prints with a fractional part, even a zero one: 5.0 prints as 5.0, not 5. If a variable is declared double, whole numbers stored in it also print with .0.
double
5.0
5
.0
int whole = 5; double frac = 5.0; System.out.println(whole); // 5 System.out.println(frac); // 5.0
▶ Try it: run this, then change something and run it again.
What does System.out.println(10.0); print?
System.out.println(10.0);
What does this print?
double x = 4; System.out.println(x);
Type exactly what this prints:
double y = 7; System.out.println(y);
True or false?