I'm trying to write a program that asks the user for input using the scanner class to name something. Then in a completely different class, reference that input.
For example:
class TeamInfo {
Scanner nScan = new Scanner(System.in);
public String GetName(){
String GetName = nScan.nextLine();
}
The issue I'm having is that the first time I reference the GetName method in the TeamInfo class, it works--At the right spot, it prompts for the team name.
However, it prompts for the team name every time after that. I can't seem to find anywhere online or in my Java Beginner's Guide how to make this input constant, so that I can reference the input. I'm also not entirely sure what it is I'm looking for, so that doesn't help.
In other words, what I want is to prompt the user one time, and then remember that answer and re-use it again and again.