What do these errors mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What do these errors mean?

I was making a program in Java and encountered some errors. Here is a link to a screenshot since I doubt it is possible to insert images into these: https://imgur.com/a/xqx9r The code in question: https://code.sololearn.com/c8MLCwQkr72O/?ref=app

3rd Jan 2018, 6:26 AM
Mia Piper
Mia Piper - avatar
3 Answers
+ 13
The scope of the variable commands is only visible within the main method itself and you have 2 ways to solve it:- ✅ Move the definition of commands outside of the method as a class variable so every method in the class can access to it. ✅ Pass it into the checkValid method as parameter Hopefully it helps! 😉
3rd Jan 2018, 6:37 AM
Zephyr Koo
Zephyr Koo - avatar
+ 3
Hi Mia, you can make your code public and then post a link to the code. That way people can run the code, see the error and hopefully help you debug it. I cannot view your link to see the screenshot as I'm at work and it gets blocked.
3rd Jan 2018, 6:28 AM
Duncan
Duncan - avatar
+ 3
Okay.
3rd Jan 2018, 6:38 AM
Mia Piper
Mia Piper - avatar