fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class GenericClass<T> {
  9. }
  10.  
  11.  
  12. public class Main {
  13. public static void main(String[] args){
  14. String foo = "foo";
  15. Class<String> stringClass = "foo".getClass();
  16. }
  17. }
Compilation error #stdin compilation error #stdout 0.08s 380224KB
stdin
Standard input is empty
compilation info
Main.java:15: error: incompatible types
		Class<String> stringClass = "foo".getClass();
		                                          ^
  required: Class<String>
  found:    Class<CAP#1>
  where CAP#1 is a fresh type-variable:
    CAP#1 extends String from capture of ? extends String
1 error
stdout
Standard output is empty