jshell> /open Array.java jshell> Integer i jshell> String s jshell> Array a; jshell> a = new Array(4); jshell> a.set(0, 3); jshell> a.set(1, 6); jshell> a.set(2, 4); jshell> a.set(3, 1); jshell> a.set(0, "huat"); | Error: | incompatible types: java.lang.String cannot be converted to java.lang.Integer | a.set(0, "huat"); | ^----^ jshell> i = a.get(0) jshell> i i ==> 3 jshell> i = a.get(1) jshell> i i ==> 6 jshell> i = a.get(2) jshell> i i ==> 4 jshell> i = a.get(3) jshell> i i ==> 1 jshell> s = a.get(0) | Error: | incompatible types: java.lang.Integer cannot be converted to java.lang.String | s = a.get(0) | ^------^ jshell> i = a.min() jshell> i i ==> 1 jshell> a.set(3,9); jshell> i = a.min() jshell> i i ==> 3 jshell> // try something not comparable jshell> class A {} jshell> Array a; | Error: | type argument A is not within bounds of type-variable T | Array a; | ^ jshell> class A implements Comparable { public int compareTo(Long i) { return 0; } } jshell> Array a; | Error: | type argument A is not within bounds of type-variable T | Array a; | ^ jshell> // try something comparable jshell> class A implements Comparable { public int compareTo(A a) { return 0; } } jshell> Array a; jshell>