Example3_15A

Example3_15A - + String.format("%.2f...

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

View Full Document Right Arrow Icon
//This program is the same as the program StringMethodFormat. //In this program, the output is shown in an output dialog box. / import javax.swing.JOptionPane; i public class Example3_15A { public static void main(String[] args) { double x = 15.674; double y = 235.73; double z = 9525.9864; int num = 83; String outputStr; outputStr = "123456789012345678901234567890" + '\n'
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("%.2f %n", x) + String.format("%.3f %n", y) + String.format("%.2f %n", z) + String.format("%7s %n", "Hello") + String.format("%5d%7.2f %n", num, x) + String.format("The value of num = %5d %n", num); JOptionPane.showMessageDialog(null, outputStr, "outputStr", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Ask a homework question - tutors are online