The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: Know Your Closures

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Friday Java Quiz: Know Your Closures Posted: Feb 1, 2008 9:55 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Friday Java Quiz: Know Your Closures
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

The closures are coming!
The closures are coming!!
The closures are coming!!!

And don't let your baby cry out loud.

To celebrate Java's entry into the closures era, today's Java quiz is about closures, specifically the BGGA closures.

Will the following

public class Fib {
  private static {int=>int} fib = {
    int n =>
      n==0 ? 0 :
      n==1 ? 1 :
      fib.invoke(n-1) + fib.invoke(n-2)
  };

  public static void main(String[] args) {
    System.out.println(fib.invoke(6));
  }
}

program compile? Run? If so, what will it print out?

You can bend the rules and actually run the prototype compiler that is available here.

Read: Friday Java Quiz: Know Your Closures

Topic: Sun has posted the call for participation and registration for CommunityOne, a free-as-in-beer... Previous Topic   Next Topic Topic: Run your web code from your IDE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use