import java.util.ArrayList; public class SmartArrayList extends ArrayList { public void printElements() { System.out.print("Output of the list:"); for (T object : this) { System.out.print(" " + object + ","); } } }