Created
June 5, 2017 14:40
-
-
Save aomnes/3daaa701b42466e12665fa298b21059a to your computer and use it in GitHub Desktop.
Thread return idée
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package view.form; | |
/** | |
* Created by antoineomnes on 05/06/2017. | |
*/ | |
class MainThread { | |
public void startMyThread() { | |
Object requiredObject = new Object(); //Map/List/OwnClass | |
Thread myThread = new Thread(new RunnableObject(requiredObject)).start(); | |
myThread.join(); | |
System.out.println(requiredObject.getRequiredValue()); | |
} | |
} | |
class RunnableObject implements Runnable { | |
private Object requiredObject; | |
public RunnableObject(Object requiredObject) { | |
this.requiredObject = requiredObject; | |
} | |
public void run() { | |
requiredObject.setRequiredValue(xxxxx); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment