*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes formatting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "formatting" Watch "formatting" New topic
Author

formatting

Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
■ "-" Left justify this argument
■ "+" Include a sign (+ or -) with this argument
■ "0" Pad this argument with zeroes
■ "," Use locale-specific grouping separators (i.e., the comma in 123,456)
■ "(" Enclose negative numbers in parentheses



can anyone explain all these things....specially the padding thing or give me a link

thank you
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

It is explained quite well on page 508 of the K&B book. Its also explained on the Formatter class docs. Try to create some programs to experiment with the things...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
yes sir....

means ( removes the - sign and wraps around the number

rest are all clear....nothing better than trying it
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531


why is b3 false....
If the argument arg is null, then the result is "false". If arg is a boolean or Boolean, then the result is the string returned by String.valueOf(). Otherwise, the result is "true".

according to this shouldnt it be true?
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Hi Ankur, I think anything other than true is considered false by Boolean(String) constructor.
So when toString() method gets called for Boolean constructor it returns the "ankur' (in your case). So apart from true anything passed as string to considered as a false


Sage of The Monstrous Toad of Mount Myoboku
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
Otherwise, the result is "true".


what does this mean then?
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
It means anything you pass to Boolean constructor. Suppose
check out following program


The output is
false
true
false
true

Did you clear what i mean??
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
understood what you are saying...but "otherwise its true" this really confuses me
rohan yadav
Ranch Hand

Joined: Oct 13, 2009
Posts: 156
Sorry in hurry i typed something weired. Are you preparing for SCJP??
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
Thanks Rohan.....i got what you said...but its the language of the doc that confused me
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
yup i am preparing
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: formatting
 
Similar Threads
WA #1.....word association
Please offer an alternative course of action...
Tasks on the cattle drive
Favorite Music Band/Artist
Books on how to win an argument