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 7: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:
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog


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: Making JUnit 4 backwards compatible Previous Topic   Next Topic Topic: Upgraded to WordPress 2.0.6 from

Sponsored Links


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