Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class DretveLoop {
- char chr = 'A';
- int N = 10;
- class MojaDretva implements Runnable
- {
- public void run(){
- for(int i = 0; i < N; i++){
- System.out.println("Thread "
- +Thread.currentThread().getName()+ ": " + i);
- }
- }
- }
- DretveLoop()
- {
- for(int i = 0; i < N; i++)
- {
- MojaDretva tlc = new MojaDretva();
- Thread t = new Thread(tlc);
- t.setName("T" + chr++);
- t.start();
- System.out.println("Thread Stanje " + t.getName() + ": " + t.getState());
- }
- }
- public static void main(String[] args) {
- new DretveLoop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement