Hello,
First of all, thank you for reading my post and trying to help me, I really appreciate it.
My issue is that I am trying to print a double but the precision is being change by the user while the program is running. Printf() in C/C++ allows an asterisk to put a variable width or precision. It is unclear on my search results if this works with Java' printf() method as well.
I have the following statement:
System.out.printf("%.*f", max, val);
with max being an integer. It prints the following error message: java.util.UnknownFormatConversionException: Conversion = '*'
Am I doing it wrong please, or is it simply not available in Java?
If it is not available, would you please have any idea for that I can print this double with a different precision at run time, by using my value max?
Thank you a lot for your help.