import java.lang.*; import java.util.Iterator; import java.util.List; import java.util.LinkedList; /** * Sample to convert String and basic type. */ class GenericTypeSample { /** * Do it. */ public void doIt() { // add elements to list. List list = new LinkedList(); list.add("Hello,"); list.add("World!"); // show list. Iterator it = list.iterator(); while (it.hasNext()) { String message = it.next(); System.out.println(message); } } public static void main(String args[]) { GenericTypeSample sample = new GenericTypeSample(); sample.doIt(); } }