The Artima Developer Community
Sponsored Link

Java Buzz Forum
Thursday Java Generics Quiz

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.
Thursday Java Generics Quiz Posted: Jan 18, 2007 10:55 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Thursday Java Generics Quiz
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

I'm going through O'Reilly's Java Generics and Collections by Maurice Naftalin and Philip Wadler to gain the necessary understanding of Java generics to effectively use it. I mentioned this book 53 days ago.

Here's something that surprised me. Can you guess if the following two classes will compile? And why?

import java.util.*;
class Foo {
  public Integer foo(List list) {
   return null;
  }
  public String foo(List list) {
    return null;
  }
}
import java.util.*;
class Bar {
  public Integer bar(List<Integer> integers) {
    return null;
  }
  public String bar(List<String> strings) {
    return null;
  }
}

Read: Thursday Java Generics Quiz

Topic: [Jan 15, 2007 18:35 PST] 11 Links Previous Topic   Next Topic Topic: Backward compatibility of specified, under-specified and un-specified features/API


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us