The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: Now For A Real Test

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: Now For A Real Test Posted: Oct 31, 2008 7:53 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: Now For A Real Test
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

Less than an hour after I posted last weeks Friday Java Non-quiz, Steve walked in, wrote some code on the white board, and said: "This should be on your Java quiz."

Here's a simplified version of his class:

1    public class Foo { 
2        public static void main(String[] args) { 
3            Foo foo = new Foo(); 
4            foo.printIt(foo.getIt()); 
5        } 
6     
7        @SuppressWarnings("unchecked") 
8        private <T> T getIt() { 
9            return (T) "hello, world."; 
10       } 
11    
12       private void printIt(String s) { 
13           System.out.println(s); 
14       } 
15   }

The question remains the same:

Q: Compile, or no compile?

Strict rules apply: No actually running the compiler. Must back answer with JSL citation.

Read: Friday Java Quiz: Now For A Real Test

Topic: GPS and Field Trips Previous Topic   Next Topic Topic: Links for October 24th from PeopleOverProcess.com

Sponsored Links



Google
  Web Artima.com   

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