Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package onethread;
- /**
- *
- * @author antoniomalevski
- */
- public class OneThread implements Runnable{
- public String a;
- public OneThread(String a) {
- this.a=a;
- }
- @Override
- public void run() {
- System.out.println(this.a);
- }
- public static void main(String[] args) {
- // TODO code application logic here
- OneThread t1=new OneThread("A");
- OneThread t2=new OneThread("B");
- OneThread t3=new OneThread("1");
- OneThread t4=new OneThread("2");
- Thread th1=new Thread(t1);
- Thread th2=new Thread(t2);
- Thread th3=new Thread(t3);
- Thread th4=new Thread(t4);
- th1.start();
- th2.start();
- th3.start();
- th4.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement