Welcome to JavaRanch. Please check your
private messages for an administrative message from JavaRanch.
In Java, all your code must be inside a class. You can't just put a method, outside of a class, in a source file. So your source file should contain something like this:
Not just a main() method without a class.
Another, small point: Prefer using the primitive type
boolean instead of the wrapper class
Boolean, as you're doing in line 7. (Note, the difference in case,
boolean and
Boolean are not the same thing).
Also, never catch exceptions and do nothing with them, as you are doing in line 45:
If an exception happens in the code, you'll never know that something went wrong. At least print the stack trace of the exception: