So I am wondering if what I did here is something that is bad or if the java garbage collector will take care of it on its own. I have two different methods below and I have taken out all irrelevant code to simplify things. I create a scanner in each method. Usually I would close the scanners to get rid of the memory leak warning, however, when I close the first scanner, I was unable to use the second. I found a solution that said just don't close the scanners and it works fine, but I am wondering if this is dangerous to do. Thanks in advance!
static String menu(){
String menuoption;
Scanner menuscanner = new Scanner(System.in);
menuoption = menuscanner.next();
return menuoption;
}// end of menu method
static void info(){
Scanner infoscanner = new Scanner(System.in);
infoscanner.next();
}//end of info method