Advertisement
Azure47

OS Lab 2.1

Mar 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args) {
  3.         new Thread(new ThreadAB("bukvi")).start();
  4.         new Thread(new ThreadAB("brojki")).start();
  5.     }
  6. }
  7.  
  8. class ThreadAB implements Runnable{
  9.     String ej;
  10.     public ThreadAB(String asd){
  11.         ej = asd;
  12.     }
  13.  
  14.     public void run() {
  15.         if(ej.equals("bukvi")){
  16.             for(char b = 'A';b<='Z';b++){
  17.                 System.out.println(b);
  18.             }
  19.         }
  20.        
  21.         else if(ej.equals("brojki")){
  22.             for(int i=0;i<=26;i++){
  23.                 System.out.println(i);
  24.             }
  25.         }
  26.        
  27.         else{
  28.             System.out.println("Nevalidna vrednost");
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement