Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- class TwoThreads {
- public static class ThreadAB implements Runnable {
- private String[] niza;
- public ThreadAB(String[] niza) {
- this.niza = niza;
- }
- public void run() {
- for(int i = 0; i < niza.length; i++){
- System.out.println(niza[i]);
- }
- }
- }
- public static void main(String[] args) {
- ThreadAB ab = new ThreadAB(new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"});
- Thread t1=new Thread(ab);
- t1.start();
- String[] brojkiNiza = new String[27];
- for(int i = 0; i <= 26; i++){
- brojkiNiza[i] = i + "";
- }
- ThreadAB brojki = new ThreadAB(brojkiNiza);
- Thread t2 = new Thread(brojki);
- t2.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement