Friday Java Quiz: Now For A Real Test
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.