Example & Tutorial understanding programming in easy ways.

Can we have an empty catch block?

Yes u can use an empty catch block in your code.

 

try {
   
// to write stuff out
 
} catch(Exception e) {
 
}

Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

Read More →