Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-16-2007, 03:29 PM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Using java.util.Formatter
Formating output using Formatter class is easy. It is some what like printf statement of C.

Code:
Formatter fmt = new Formatter();
fmt.format("Testing %s: %n %s is %d %n %s is %f", 
            fmt.getClass(),"Integer", 10, "Float", 10.4);
System.out.println(fmt);
Output:
Code:
Testing class java.util.Formatter: 
 Integer is 10 
 Float is 10.400000
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Stack class in java.util package Java Tip java.lang 0 04-16-2008 11:32 PM
java.util Java Tutorial Java Tutorials 1 02-07-2008 02:46 PM
Using java.util.Stack Java Tip Java Tips 0 11-20-2007 06:17 PM
java.util.DateFormat not found in import christina New To Java 2 08-05-2007 11:31 PM
how to use java.util.Properties? christina New To Java 2 08-03-2007 06:26 PM


All times are GMT +2. The time now is 12:40 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org