Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.io.File;
- public class Main
- {
- public static void main(String[] args) {
- //System.out.println("Execution into the main class");
- ThreadClass t1=new ThreadClass("T1");
- ThreadClass t2=new ThreadClass("T2");
- t1.start();
- t2.start();
- //se ozvrsuvaat naizmenicno bidjeki rabotat vo odredeni time slotovi
- }
- }
- class ThreadClass extends Thread
- {
- String name;
- public ThreadClass(String name)
- {
- this.name=name;
- }
- @Override
- public void run() {
- System.out.println("Ececution in the thread");
- for(int i=0;i<20;i++)
- {
- System.out.println("Thread: "+name+": "+ i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement