Results 1 to 3 of 3
Thread: Format issue
- 01-13-2011, 11:44 AM #1
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
Format issue
hi friends,
i have an issue in formatting. i tried to pad zeros and add minus sign but it produce exception. but if i add plus sin then it works fine.
class FormatTest1
{
public static void main(String ... args)
{
int i2 = 123456;
System.out.format(">%2$+,09d< \n", i2,100000);
}
}
it works ok
but
class FormatTest1
{
public static void main(String ... args)
{
int i2 = 123456;
System.out.format(">%2$-,09d< \n", i2,100000);
}
}
get exception
whats happening here?
cant we pad zeros with a minus sign?
- 01-13-2011, 12:12 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,393
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 01-13-2011, 12:18 PM #3
Member
- Join Date
- May 2010
- Posts
- 90
- Rep Power
- 0
Similar Threads
-
Format the output
By Moustafa taha in forum New To JavaReplies: 5Last Post: 10-18-2010, 05:01 AM -
What format is a getText()?
By AJArmstron@aol.com in forum New To JavaReplies: 1Last Post: 04-18-2010, 01:43 AM -
JSP code format
By joeyxaza in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 02-20-2009, 05:11 PM -
how to convert one format to another format
By mahipal_reddy621 in forum New To JavaReplies: 1Last Post: 12-02-2008, 10:21 AM -
Format
By 2ndis1stplaceloser in forum New To JavaReplies: 2Last Post: 10-21-2008, 06:38 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks