3 ms·
The work done in the constructor is to ensure you have a working object, so that calls to any of its methods can never end with a null pointer exception or any
by RedShift1 4y ago
The work done in the constructor is to ensure you have a working object, so that calls to any of its methods can never end with a null pointer exception or any other exception that can reasonably be prevented/thrown in the constructor.
Opening a file and truncating it sounds totally unexpected and I never do such things like touching the filesystem or running queries in a constructor.