string.format in jFormatoptionpane code example
Example: string.format in jFormatoptionpane
JOptionPane.showMessageDialog(null, "You win a discount coupon of $" + String.format("%.2f", (groceriesCost*tier1)) +
". (8% of your purchase.)");