Top "Runnable" questions

The Runnable interface defines a single method, run, meant to contain the code executed in the thread.

"implements Runnable" vs "extends Thread" in Java

From what time I've spent with threads in Java, I've found these two ways to write threads: With implements Runnable: …

java multithreading runnable implements java-threads
The difference between the Runnable and Callable interfaces in Java

What is the difference between using the Runnable and Callable interfaces when designing a concurrent thread in Java, why would …

java multithreading interface runnable callable
What's the difference between Thread start() and Runnable run()

Say we have these two Runnables: class R1 implements Runnable { public void run() { … } … } class R2 implements Runnable { public void run() { … } … } …

java multithreading concurrency runnable
Runnable with a parameter?

I have a need for a "Runnable that accepts a parameter" although I know that such runnable doesn't really exist. …

java runnable
Naming threads and thread-pools of ExecutorService

Let's say I have an application that utilizes the Executor framework as such Executors.newSingleThreadExecutor().submit(new Runnable(){ @Override public …

java threadpool runnable executorservice managedthreadfactory
In a simple to understand explanation, what is Runnable in Java?

What is "runnable" in Java, in layman's terms? I am an AP programming student in high school, whose assignment is …

java runnable
new Runnable() but no new thread?

I'm trying to understand the code here , specifically the anonymous class private Runnable mUpdateTimeTask = new Runnable() { public void run() { final …

java android multithreading runnable
Android: How do I stop Runnable?

I tried this way: private Runnable changeColor = new Runnable() { private boolean killMe=false; public void run() { //some work if(!killMe) …

android runnable
Returning a value from Runnable

The run method of Runnable has return type void and cannot return a value. I wonder however if there is …

java runnable
Is there a way to make Runnable's run() throw an exception?

A method I am calling in run() in a class that implements Runnable) is designed to be throwing an exception. …

java android runnable throws