Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static int plukj = 0;
- public static void main(String[] args){
- final long startTime = System.currentTimeMillis();
- Thread a = new Thread(){
- public void run(){
- while(System.currentTimeMillis() < startTime + 20000){
- plukj++;
- System.out.println(plukj + " Adding");
- }
- System.out.println("FINISHEDA");
- }
- };
- Thread b = new Thread(){
- public void run(){
- while(System.currentTimeMillis() < startTime + 20000){
- plukj--;
- System.out.println(plukj + " Substracting");
- }
- System.out.println("FINISHEDB");
- }
- };
- a.start();
- b.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement