import java.text.*;
public class TryStuffOut {
public static void main(String[] args) {
double n=12323233.445;
DecimalFormat x = new DecimalFormat("#.##");
System.out.println(x.format(n));
}
}
why does this round the decimal part down to .44 and when i switch the variable n to double n=12323233.415;
it rounds up to .42 . Why?
and does the # in front of the deicmal matter to how many digits I have because it still seems to print out the entire number even thought I only have 1 pound sign.
Thanks