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 programparalel;
- /**
- *
- * @author 6530729
- */
- public class ProgramParalel extends Thread{
- /**
- * @param args the command line arguments
- */
- static int x = 0;
- public void run(){
- for(int i = 0;i<999;i++){
- this.x++;
- }
- }
- public static void main(String[] args) {
- //Operacao t1 = new Operacao();
- //t1.start();
- ProgramParalel t1 = new ProgramParalel();
- t1.start();
- ProgramParalel t2 = new ProgramParalel();
- t2.start();
- ProgramParalel t3 = new ProgramParalel();
- t3.start();
- try{
- t1.join();
- t2.join();
- t3.join();
- }catch(Exception e){
- System.out.print("Não foi possivel");
- }
- System.out.print(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement