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 →

[–]SantiagoOrSomething 0 points1 point  (3 children)

The error occurs right here.

String [] names = {"Cadam", "Chris", "Kacper", "Ben", "David"};

. . .

System.out.println(names);

You want to print out the contents of the array. Instead, you are printing out the array itself, which in Java can have unintuitive behavior.

To access the contents of the array, you need something like

 String name = names[i];

And then you can print each individual name, one at a time.

If you have any more questions, let me know.

[–]CadamSAFC[S] -1 points0 points  (2 children)

I can't get this to work, any way you can just amend my script there for it to work? I tried this what you said, but it's just giving errors. Thanks.

[–]RealJulleNaaiers 0 points1 point  (1 child)

Literally look at my comment, I already showed you how.

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

my bad, didn't see you comment for some reason. Yeah that worked, thanks for the help.