Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Multiply { // Example of multiply with AtomicInteger
- public static void main(String[] args) {
- int x,y;
- x = 2;
- y = 5;
- AtomicInteger control = new AtomicInteger( (!(x<y)) ? x : y );
- AtomicInteger condition = new AtomicInteger( (x<y) ? x : y );
- System.out.println( control.get() );
- while ( condition.decrementAndGet() > 0 ) {
- System.out.println( control.addAndGet( (!(x<y)) ? x : y) );
- }
- }
- }
Add Comment
Please, Sign In to add comment