Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TwoThreads {
- public static class ThreadAB implements Runnable
- {
- String string1;
- String string2;
- public ThreadAB(String string1, String string2) {
- this.string1 = string1;
- this.string2 = string2;
- }
- @Override
- public void run() {
- System.out.println(string1);
- System.out.println(string2);
- }
- }
- public static void main(String[] args) {
- Thread t1 = new Thread(new ThreadAB("1", "2"));
- Thread t2 = new Thread(new ThreadAB("a", "b"));
- t1.start();
- t2.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment