So actually you want your program to take a number as input, and you want a way to get back a given digit n in the number?
For example you have the number 56231012 , and you want a way to get a certain digit, for example the second, which is 1, or the third, which is 0 ?
This can be easily achieved by a method, you don't need an array for this purpose, but an array will also do fine.
[edit]
Just for the sake of clarity: you can't use the array notation in Java on anything but an array.
Since a primitive, like an integer variable isn't an array, you can't use array notation (= using square brackets) with it, so you'll have to break the number down into digits manually.
[/edit]
Last edited by tux4life; Oct 21st, 2009 at 5:00 pm.
Reputation Points: 2125
Solved Threads: 243
Postaholic
Offline 2,105 posts
since Feb 2009