trivial string formatting problem that I just cannot find the answer to
Despite all my searching on the web and in books, I cannot find the solution to this trivial problem.
All I want to do is output (in a JTextField called 'messageBox') the value of PI to two decimal places in a text field of total length five characters.
I think I need to do some 'wrapping' and then some string formatting, and I +think+ I need to give the format method a formatting string. Hope the intent of the following attempted code is clear, and hope you can help. Thanks in advance.
double myPI = 3.1415926535;
Double myWrappedPI = 0.0;
myWrappedPI = myPI;
messageBox.setText("myWrappedPI approximated is: " +