Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TwoThreads {
- public static class ThreadAB implements Runnable
- {
- String s;
- private ThreadAB(String string)
- {
- this.s = string;
- }
- public void run()
- {
- System.out.println(s);
- }
- }
- public static void main(String[] args) {
- Runnable run1 = new ThreadAB("A" + "\n" + "B");
- Runnable run2 = new ThreadAB("1" + "\n" + "2");
- Thread Thread1 = new Thread(run1);
- Thread Thread2 = new Thread(run2);
- Thread1.start();
- Thread2.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement