fork(1) download
  1. public class SelectionSortGenerics {
  2.  
  3. public static <E> void f(E[] a) {
  4. }
  5.  
  6. public static void main(String[] args){
  7. int[] arr2 = {3,4,1,5};
  8. f(arr2);
  9. }
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class SelectionSortGenerics is public, should be declared in a file named SelectionSortGenerics.java
public class SelectionSortGenerics {
       ^
Main.java:8: error: method f in class SelectionSortGenerics cannot be applied to given types;
        f(arr2);
        ^
  required: E[]
  found: int[]
  reason: inference variable E has incompatible bounds
    equality constraints: int
    upper bounds: Object
  where E is a type-variable:
    E extends Object declared in method <E>f(E[])
2 errors
stdout
Standard output is empty