Example3_16 - String.format"The value of z with two...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.JOptionPane; i public class Example3_16 { public static void main(String[] args) { double x = 15.674; double y = 235.73; double z = 9525.9864; String str; str = String.format("The value of x with two decimal places = %.2f%n", x) + String.format("The value of y with two decimal places = %.2f%n", y)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + String.format("The value of z with two decimal places = %.2f%n", z); JOptionPane.showMessageDialog(null, str, "Formatting with the String Method format", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online