+ 1

write a statement to convert 1002 into int

Anybody help me with this?

23rd Aug 2017, 3:18 PM
Shalmi
Shalmi - avatar
11 odpowiedzi
+ 1
I didn't understand what you are trying to say, can you show me your code and a proper explanation of whats going wrong Please
23rd Aug 2017, 3:22 PM
CoolCoder
CoolCoder - avatar
+ 1
But 1002 is already an integer, can u just copy/paste the question and show it to me?
23rd Aug 2017, 4:44 PM
CoolCoder
CoolCoder - avatar
+ 1
I guess the 1002 is wrapped in double quotes like this "1002" is it?
23rd Aug 2017, 4:49 PM
CoolCoder
CoolCoder - avatar
+ 1
I guess the 1002 is wrapped in double quotes like this "1002" is it?
23rd Aug 2017, 4:51 PM
CoolCoder
CoolCoder - avatar
+ 1
Then it's easy: String number = "1002"; int result = Integer.parseInt(number); System.out.println(result);
23rd Aug 2017, 5:42 PM
CoolCoder
CoolCoder - avatar
+ 1
No problem 🤗🤗🤗🤗 and I wish you luck in your programming and life 😊😊
23rd Aug 2017, 5:50 PM
CoolCoder
CoolCoder - avatar
0
Here...they have asked us to write a java programme to convert 1002 into integer...in first place, im not sure what it even means..
23rd Aug 2017, 4:21 PM
Shalmi
Shalmi - avatar
0
And that is actually my confusion
23rd Aug 2017, 4:48 PM
Shalmi
Shalmi - avatar
0
The question which I asked is the complete one...
23rd Aug 2017, 4:49 PM
Shalmi
Shalmi - avatar
0
Oh yesss..sorry, forgot that in the question
23rd Aug 2017, 4:57 PM
Shalmi
Shalmi - avatar
0
Thank you so much ! I just..got to know the diff btw double and single quotes...:) thanx again
23rd Aug 2017, 5:48 PM
Shalmi
Shalmi - avatar