Look at my post#18 to see how to code and use a class level variable.
Your code still declares randomnumber as local to the onGuildMessageReceived method.
Also see the tutorial:...
Type: Posts; User: Norm
Look at my post#18 to see how to code and use a class level variable.
Your code still declares randomnumber as local to the onGuildMessageReceived method.
Also see the tutorial:...
Where? Did you post the new version?
Does it work now?
Here is an example of how to declare a variable at the class level:
class Testing {
int aClassLevelVar; // declare a class level variable
public void someMethod() {
int aLocalVar...
Yes, that is how it is coded. Each call will get a new number. That is what the nextInt method does.
What do you want the gene method to do? Please explain.
That method has only local variables which means no other method can see their values. rrr and number are locally defined in the gene method.
Their values are not accessible outside of the gene...
Yes.
If a method stores a value in a class level variable, that value will be available to any method in the class until some method changes it to a new value.
Make a declaration for that variable that is outside of any method but within the definition for the class.
Remove the variable's declaration from inside of the 'onGuildMessageReceived' method. The...
Which one do you want to do?
Ok. That looks better.
Did you try one of the solutions I suggested?
What did you change? I do not see the code tags.
Either declare it at the class level so all methods can see it
or pass it as an argument to the method.
Please edit your post and wrap your code with code tags:
**YOUR CODE GOES HERE**