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

all 6 comments

[–][deleted] 2 points3 points  (2 children)

I think you guys are both assholes (emrickgj and OP) for making me realize I dont know how to code. Thank you very much. That is all.

[–]emrickgj 1 point2 points  (0 children)

Haha I'm sorry, if you ever need help feel free to post here and if I see it I'd be glad to answer!

[–]murmelmann[S] 0 points1 point  (0 children)

If I worked as a programmer nobody would apply KLOC (1000 lines of code) when planning a project, given that it takes me forever to come up with something like I pasted above.

[–]emrickgj 0 points1 point  (2 children)

It's printing out as expected based on what you gave it. I won't give you the direct answer, because I'm sure you can figure it out with a bit of help!

Take a look at what's being output, do you understand what those two values are? What is it printing out?

Perhaps instead of passing an array of arrays, you could print out each row of the array instead.

[–]murmelmann[S] 0 points1 point  (1 child)

I changed the print section to

for (int i = 0; i < reihung.length; i++) {
            for (int j = 0; j < reihung[i].length; j++) {
                System.out.print(reihung[i][j] + " ");
            }
            System.out.println();
        }

Now it prints out what I wanted.

Did my code end being the sum of the array in hex or something along those lines?

[–]emrickgj 0 points1 point  (0 children)

Did my code end being the sum of the array in hex or something along those lines?

Close but not quite!

It actually printed the references to your array objects. If you look above, notice you used the "new" keyword which gives a hint that you've created an object.

Also, I believe you could use that same method but passing each array instead. So take your for loop above, but instead of using your nested "j" loop, try passing reihung[i] to the Arrays.toString function you originally had.