Skip to content

Instantly share code, notes, and snippets.

@johanrovala
Last active August 29, 2015 14:16
Show Gist options
  • Save johanrovala/020b0ad8595cb92b71a5 to your computer and use it in GitHub Desktop.
Save johanrovala/020b0ad8595cb92b71a5 to your computer and use it in GitHub Desktop.
Problem with instantiating generic types.
package Task2;
/**
* Created by Johan on 2015-03-11.
*/
public class QueArr<T> {
private T[] arr;
private int first;
private int last;
private int length = 8;
public QueArr(){
arr = new T[length]; // Type parameter 'T' cannot be instatiated directly
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment