I’m new to Java and I’m not sure if I even ask this question right.
I have two voids, in the second one I get my string and I want to use it my main void.
The code is something like that:
public void onCreate(Bundle savedInstanceState) {
shuffle();
//Here I want to use the string correctAnswer
}
public void shuffle() {
String correctAnswer = "whatever";
}
If you want to use the String calculated in the second function, why use void?
You could also make correctAnswer an instance variable: