StringMethodformat

StringMethodformat -...

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

View Full Document Right Arrow Icon
5 public class StringMethodformat { public static void main (String[] args) { double x = 1±.674; double y = 23±.73; double z = 9±2±.9864; int num = 83; String str; System.out.println("1234±678901234±678901234±67890"); System.out.println(String.format("%.2f", x)); System.out.println(String.format("%.3f", 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: System.out.println(String.format("%.2f", z)); System.out.println(String.format("%7s", "Hello")); System.out.println(String.format("%±d%7.2f", num, x)); System.out.println(String.format("The value of num = %±d", num)); str = String.format("%.2f", z); System.out.println(str); } }...
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