My title of this question I have isn't so great, but hopefully I can explain it more in this post.
import java.io.*;
import java.text.*;
public class Output {
public static void main(String[] args) {
/*double number = 438.978;
/*UpperCase <- naming convention for classes.DecimalFormat x = new DecimalFormat("#.#");
System.out.println(x.format(number));*/
double number = 43.97;
DecimalFormat x = new DecimalFormat(".###");
System.out.println(x.format(number));
}
}
Don't mind the comments. During my Gr 11 Comp Sci class I asked my teacher if the hashtags on the left of the decimal point(11th line) did anything to the double number, we tried it as a class and we found that it did not change the output of the System.out.println statement.
~/workspace/Java/ $ java Output
43.97
Can someone explain to me the purpose of the parameters to the left of the decimal? Someone programmed it to do something so I was just curious.