I am trying to compile my NameRecord.java file, but I keep getting the following error: cannot find symbol num = input.nextLine(); It's saying the Scanner input is the issue, but I initialized and populate the Scanner input before I call the NameRecord class.
Both of these classes are in the same directory, so I am not sure what I am doing wrong.
This is the class that calls the NameRecord class. It does not compile I keep getting a symbol not found Method NameRecord(String):
I left out a couple of methods that are also included in this class to conserve space.
The issue that is preventing this from compiling is that the
NameRecordclass has no way of knowing aboutinput. This is an issue of scope. The only place where your code "knows about"inputis within thetry-catchblock in themainmethod ofNameGameFrame. You should pass theStringreturned byinput.nextLine()toNameRecordfor this to work the way you want it to.That being said, this is one of about 20 problems with your code.