Jesper Young wrote:Do you get an error message from the compiler when you try to compile your source code? If so, then what is the exact error message? Or do you get an error when you run this? If so, then what happens exactly and how does that differ from what you expected?
AutoHistory.java:63: cannot find symbol
symbol : variable vehicleFile
location: class AutoHistory
if (vehicleFile.records != 0)
Sebastian Janisch wrote:okay there we go ...
you declare vehicleFile in the main method, so it is a local variable and it's goes out of scope immediately after you leave the method ..
so, either you create the MyDB reference in the class you are using it in, or you pass it as an argument ...
Isn't there a way to declare it globally?
that would be declaring it as an instance variable (or static depends on your structure) ...
be aware though, that you cannot use instance variable from a static context, which means you won't have access to it from the main method.
basically, you always should leave the main method as quickly as possible and work on the instance of the class, like this..