fork download
  1. class MyClass<Item extends Comparable> {
  2. private Item[] items;
  3. private Item[] copies;
  4.  
  5. public MyClass(Item[] items) {
  6. this.items = items;
  7. this.copies = (Item[]) new Comparable[items.length];
  8. for (int i = 0; i < items.length; ++i) {
  9. copies[i] = items[i];
  10. System.out.println(copies[i]);
  11. }
  12. }
  13. }
  14. public class Main {
  15. public static void main(String[] args) {
  16. Integer[] items = {23, 36, 45, 66, 25, 38, 47};
  17. MyClass<Integer> myClass= new MyClass<Integer>(items);
  18. }
  19. }
Success #stdin #stdout 0.09s 32668KB
stdin
Standard input is empty
stdout
23
36
45
66
25
38
47