I am storing the String value to the integer.
String a="04";
int aInt = Integer.parseInt(a) ;
but then I get 4 instead of the 04.
So what should i have to do for it ?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
why do you need 04 in a int variable as there will be no meaning of it. ya but when you want to print it it may be your requirement to display leading zeros.
adding leading 0 in an integer doesn’t make any sense internally. so better you can handle tis part when you want to display.
you can display leading zeros as follow: