Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- import javax.swing.*;
- public class decimalFormat {
- public static void main(String[]args) {
- DecimalFormat df= new DecimalFormat("##,##0.00");
- String s= JOptionPane.showInputDialog(null,"Please enter a number");
- s= df.format(s);
- double t=Double.parseDouble(s);
- JOptionPane.showMessageDialog(null,"Your number rounded to two digits is");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement