Post the code that you do have and we can take a look at it.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
Very close. Move the BufferedReader outside of your loop and put a try-catch block around the readLine() and parseInt() section.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
because 2 != 222 or 22. If you really need to match each digit, then you need to parse each digit of the number as an Integer, rather than the entire String, of course. Try to work something in, in between the readLine and the parseInt and then, if it still doesn't work, post that modified code and clearly explain the problem, with all error/compiler messages (if any).
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
toCharArray() ?
Read the API for String.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
ok.. yah.. i need to reach each digit .. not read the number as a whole so i can count the number to times that the number appeared... can someone give me the code hehe...
They already told you how to do it. Get the number as a String and examine each character. In fact, you are reading the number as a String to begin with, so why bother converting it to an int if you just want to convert it back to a String? Read the API for String, there are plenty of very clear methods for looking at smaller pieces of that String.
Write some code for it and if you still can't get it to work, post it. Giving you the code won't help you learn a thing.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847