So I use the line a lot.
FileReader reader = new FileReader(file)
and I want to make this line a member variable. Like this:
private FileReader reader = new FileReader(file);
The problem is that java doesn't like this and gives the error:
The default constructor cannot handle exception type FileNotFoundException thrown by implicit super constructor. Must define an explicit constructor Java(16777362)
So I made a constructor like this:
protected Json() throws FileNotFoundException
{
//
}
the problem is, is that I use the JSON class in different classes and those classes will give the same error, so I had to edit the other classes, but that ended up looking really ugly and gave a lot of problems. Is there a solution to this problem?