import edu.princeton.cs.algs4.StdOut; public class Example2 { // Implement SmallArray which has the following API: // - public final int K // (a constant that is the max number of elements it contains) // - public SmallArray(T[] elements) // - public int length() // - public T get(int i) // (return the i-th element if i < K and throw an exception // if not in range) public static void main(String[] args) { // Add these types to get rid of warnings String[] array = { "hello", "world", "!" }; SmallArray sa = new SmallArray(array); StdOut.println(sa); for(int i = 0; i < sa.length(); i++) StdOut.println(sa.get(i)); sa.get(10); } }