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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -