So, you are trolling? Java can accomplish what most people use closures for no problem. I do not dispute this, but they are not closures in the definition sense. This would be akin to claiming that java always had varargs because you could have always just passed an object array in at the end.
On Mon, Sep 12, 2011 at 6:34 PM, clay <[email protected]> wrote: > 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. > > -- 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.
