java - Class and variable -
i'm triying create game on java. game working , create class high score. variable "score" exists in 1 class, , created variable highscore in one.
in second class wrote :
if (highscore < score) { highscore = score;}
but doesn't recognize variable "score" if class in same package , variables , class public... can me?
score attribute of other class, try access object class access it. example:
player p = new player(); ... if(highscore < p.score) ...
Comments
Post a Comment