Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

leading zero in String

 
anjali ray
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a string which has a zero in the beginning.
For example 01254.
When I write it into a file using BufferedWriter the 0 in the beginning is dropeed and onlu 1254 is written.
How can I write the whole 01254 in the file.
Any help will be highly appreciated.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49729
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which method of the BufferedWriter are you using? How are you getting 01245 into the String in the first place?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic