Last active
March 23, 2017 22:12
-
-
Save LargePixels/b49afca7188573c9f0fff26e4edb53a5 to your computer and use it in GitHub Desktop.
This file contains 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 net.largepixels.examples.threading.basicthreading; | |
/** | |
* Created by johnminchuk on 3/23/17. | |
*/ | |
public class BasicThreading { | |
class ThreadA implements Runnable { | |
@Override | |
public void run() { | |
while (true) { | |
System.out.println("Thread A!"); | |
} | |
} | |
} | |
class ThreadB implements Runnable { | |
@Override | |
public void run() { | |
while (true) { | |
System.out.println("Thread B!"); | |
} | |
} | |
} | |
private void runMe() { | |
Thread a = new Thread(new ThreadA()); | |
Thread b = new Thread(new ThreadB()); | |
a.start(); | |
b.start(); | |
while (true) { | |
System.out.println("Thread Main!"); | |
} | |
} | |
public static void main(String args[]) { | |
BasicThreading basicThreading = new BasicThreading(); | |
basicThreading.runMe(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment