I guess your problem with the pound symbol (�) is that you're running the application in a command line box (cmd.exe) in Windows. The problem is that the command line uses a different character set (IBM-PC OEM) than Windows (usually ISO-Latin1 in Western countries). So what you type in a your text editor or
IDE does not necessarily show up the same in the console window. This is a problem that shows up quite often when we print message strings in languages other then English.
I can think of three possible solutions:
1. Use an other operating system such as Linux or MacOS X.
2. Have your output go to graphical component (such as a Swing JFrame) instead of the standard output in a console window.
3. Try using the IBM-PC OEM character code for the pound symbol in your string: System.out.println("\u009C");
About printing a numerical quantity with a fixed number of decimal digits, you can use the java.text.DecimalFormat class:
Or, if you�re using
Java 5.0, the new printf method comes in handy:
I hope this helps.
...Ariel