Easy:

        public static void main(String[] args) {
                final AtomicInteger myInt = new AtomicInteger(0);

                Runnable a = new Runnable() {
                        @Override
                        public void run() {
                                myInt.incrementAndGet();
                        }
                };
                Runnable b = new Runnable() {
                        @Override
                        public void run() {
                                System.out.println(myInt.get());
                        }
                };

                a.run();
                b.run();
        }


On Sep 12, 4:44 pm, Josh Berry <[email protected]> wrote:

> So, make a 2 closures and then alternate calling each where the first
> increments an int, and the second prints it.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to