Unhandled exception type InterruptedException : Java Threads

If you get "Unhandled exception type InterruptedException" in your java programing that contains threads then you must surround the code with a try/catch block that handles InterruptedException.

InterruptedException is a checked exception, which is used to indicate the current thread that it has been interrupted by an some other thread while it was doing some operation.

Example: InterruptedExceptionEx.java
package com.code2care.threadsexamples;

public class InterruptedExceptionEx implements Runnable {

	public void run() {
		for(int i = 0;i<=10;i++) {
			System.out.println("Runnable Tread : "+ i);
			try {
			} catch (InterruptedException e) {


Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.