In Java How can I write I/O code that must be in try catch block inside a Constructor without try-catch in the costructor? Like for a method we can pass the exception to the caller of the method by writing throws in method defination and we can remove try-catch. how we can remove try-catch in a constructor for the I/O code. Thats question asked by a interviewer to me. i said it cant be done and i really dont have an idea. Guys what you think. Please suggest??
throwspart of the declaration.initialize()method and call it on your newly created object?