GuessGame.java:51: cannot find symbol
symbol : method createPlayers()
location: class GuessGame
createPlayers();
^
GuessGame.java:55: cannot find symbol
symbol : variable player
location: class GuessGame
player[x].setPlayerNum(n);
^
GuessGame.java:63: cannot find symbol
symbol : variable TheNumber
location: class GuessGame
TheNumber.setNum(n);
^
GuessGame.java:67: cannot find symbol
symbol : method compareNumbers(int)
location: class GuessGame
System.out.println("╨Я╨╡╤А╨▓╤Л╨╣ ╨╕╨│╤А╨╛╨║ ╤Г╨│╨░╨┤╨░╨╗? " + c
ompareNumbers(0));
^
GuessGame.java:68: cannot find symbol
symbol : method compareNumbers(int)
location: class GuessGame
System.out.println("╨Т╤В╨╛╤А╨╛╨╣ ╨╕╨│╤А╨╛╨║ ╤Г╨│╨░╨┤╨░╨╗? " + c
ompareNumbers(1));
^
GuessGame.java:69: cannot find symbol
symbol : method compareNumbers(int)
location: class GuessGame
System.out.println("╨в╤А╨╡╤В╨╕╨╣ ╨╕╨│╤А╨╛╨║ ╤Г╨│╨░╨┤╨░╨╗? " + c
ompareNumbers(2));
^
6 errors
...
randomNum TheNumber = new randomNum();
player[0] = new playerStuff();
player[1] = new playerStuff();
player[2] = new playerStuff();
public boolean compareNumbers(int x) {
...
GuessGame.java:51: cannot find symbol
symbol : method createPlayers()
location: class GuessGame
createPlayers();
^
Is there a special place, where I can read about these rules? I'm just trying to make my code as much understandable as I can, so I and anybody else could read my code easily.Tim Moores wrote:... Lastly, you should get in the habit of starting class names with uppercase letters - that's what the rest of the Java world does, and expects from code they read. So, "PlayerStuff" and "RandomNum" instead of what you have now.
Rich McStone wrote:I couldn't call methods on objects because these methods were in another class(castle)?
Rich McStone wrote:As I understood, I have to use variables in the same method where they have been created.
Rich McStone wrote:So because of that, I put all variables in one methods and I interacted with them inside the same method.
Henry Wong wrote: This is only true for local variable. This is not true for other types of variables (such as instance and static variables), which operate at a different scope.
Rich McStone wrote: I couldn't call methods on objects because these methods were in another class(castle)?
Henry Wong wrote: Putting everything in one method, is really *not* a good idea... which many will point out to you soon.
Is there a special place, where I can read about these rules?
Tim Moores wrote: While http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html is labelled as no longer maintained, it is still a good starting point. The general rules for naming and organizing things have not really changed. Google also has some ideas on that: https://google.github.io/styleguide/javaguide.html
Rich McStone wrote:
Henry Wong wrote: This is only true for local variable. This is not true for other types of variables (such as instance and static variables), which operate at a different scope.
I guess I haven't got to that part yet. I didn't learn about other types of variables.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |