#How do I fix undeclared variable error when I call method from another class?

1 messages · Page 1 of 1 (latest)

heady igloo
#

When I use a method from a class, I get an undeclared variable error. Error under ‘player’ in player.getMaxWeight. How do I fix this?

covert gazelleBOT
#

<@&987246399047479336> please have a look, thanks.

cunning roost
#

Would be nice if you provided your code to look at

chrome sorrel
#

The variable is likely private, package scoped. Either way you should be using a getter.

#

But please also share your code.

covert gazelleBOT
#

Please use this format for posting code:

```java
// Example java program
int value = 5;
System.out.println(value);
```

Which results in:

// Example java program
int value = 5;
System.out.println(value);

For syntax highlighting, you have to add the name of the language after the three backticks, like ```java. Please make sure to use exactly this format, so no space between the backticks and the language name, and a newline before the code starts. If done right, the syntax highlighting will even be applied to your text as you type, before sending.