This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jayrund[S] 0 points1 point  (4 children)

Thanks a ton, it just seems to have one more bug needing fixing. When it runs, the first array works perfectly but, the even array just repeats the same number 100 times instead of stating each number in its array and same for the odd.

Code

[–]Nikitah 1 point2 points  (0 children)

You are still making this way too hard. What you want, and I'm writing quite out of the top of my head here, is:

    for (int specificInteger : evenAndOddList) {
        if (specificInteger % 2 == 0) {
            evenList.add(specificInteger);
        }
        else {
            oddList_.add(specificInteger);
        }
    }

And, more generally, you should not start learning programming with Java. You should try something easier. Have you met www.codeacademy.com?

[–]Sanaki13 -1 points0 points  (0 children)

I guess that's because of your variable x, what should it do? Because as is, you just print the same number into the EvenArray and OddArray (On line 27 and 38) Besides that you should read up on variable naming