String name=null;
public void firstUse(){
if(name!=null)
{
System.out.println("Hello "+name);
}else
{
Scanner scan=new Scanner();
System.out.println("Insert your name please:");
String ins=scan.nextLine();
setName(ins);
}
}
can I set the name only one time by saving it directly in the code?