0
Java - What am I doing wrong?
[Solved] I had to call checkGrades() and add grades as an argument. This is for Java. What am I doing wrong? I'm trying to complete the practice problem which is commented at the top of the code. Code: https://pastebin.com/Hr9aKHLJ Thank you. Please note: I have not fully completed the practice problem yet.
5 Respostas
0
Well, I came up with the problem myself so any method would work but I haven't reached objects yet so it'd probably take a lot of explanation to understand.
I've just finished the arrays section and decided to spend some time actually practicing the code so I actually know how to write it.
The issue is that it's not printing the messages and it should be.
0
Oh thank you, for the calling checkGrades message.
What do you mean the grades array is out of scope? You mean that I need to do: for (int i: grades-1) ? rather than for (int i: grades).
When I try running it with (int i: grades-1) AND when I try running it without the -1, then I get this error:
https://pastebin.com/FZQDw2pP
0
Ah okay. So would I need to move the array information from main() to checkGrades()? Is there a way to keep it where it is then allow it to exist or work in checkGrades()? I know in Python you can use "global variableName".
0
Oh didn't see your last line sorry. Will try that.
0
Thank you! That fixed it.
Oh okay, good to know. For your latest msg.
Also, I like your name & profile picture =)