Java – List Example

List example give a method, how to use List in java:

  1. Code:
    import java.util.Iterator;
    import java.util.List;
    import java.util.ArrayList;
    public class ListExample {
        public static void main(String[] args) {
            // List Example implement with ArrayList
            List<String> ls=new ArrayList<String>();
            Iterator it=ls.iterator();
              String value=(String);
              System.out.println("Value :"+value);
  2. Output:
    List Value :One
    List Value :Three
    List Value :two
    List Value :four

Reference Link:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s