In this class we don't have any method, because the constructor is already calling to its only method with functionality? this is not correct, first you should instance the class and then call the writer and not directly when you are creating the instance of the class, besides that the read and writing of a file should be placed inside a try/catch block