The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: Can Your Thread Withstand My Interruption

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: Can Your Thread Withstand My Interruption Posted: Nov 6, 2009 6:09 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: Can Your Thread Withstand My Interruption
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

It has been 1267 days since Java Concurrency in Practice was published. I trust that all self-respecting Java programmers have read the book cover-to-cover. Today's Friday Quiz is a concurrency one.

Q: Will the following Java class compile? Run without exceptions? If so, what does it print?

import java.util.concurrent.BlockingQueue; 
import java.util.concurrent.LinkedBlockingQueue; 
 
public class Foo { 
    public static void main(String[] args) throws InterruptedException { 
        BlockingQueue<Integer> q = new LinkedBlockingQueue<Integer>(); 
        q.put(1); 
        Thread.currentThread().interrupt(); 
        System.out.println(q.take()); 
    } 
}

Strict rules apply: No actual compiling, peeking into the book, or surfing the web for Javadocs or other clues is allowed for the first 30 minutes.

Bonus Q: How many authors are named on the cover of Java Concurrency in Practice? Name three of them.

Bonus QQ: Name the other three.

Read: Friday Java Quiz: Can Your Thread Withstand My Interruption

Topic: Missouri partners with Microsoft to provide residents with free access to e-learning programs Previous Topic   Next Topic Topic: Tech Tip: Using CDI and Dependency Injection for Java in a JSF 2.0 Application

Sponsored Links



Google
  Web Artima.com   

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