How to get sub list from vector?

How to get sub list from vector?

The method subList() helps us to get sub range from the given vector object.

subList(int fromIndex, int toIndex)

Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive.

package vector;

import java.util.List;
import java.util.Vector;

public class VectorSublistExample {

  public static void main(String[] args) {
    Vector<String> vct = new Vector<String>();
        //adding elements to the end
    vct.add("India");
        vct.add("Autralia");
        vct.add("New Zealand");
        vct.add("England");
        vct.add("New Delhi");
        System.out.println("Actual vector:"+vct);
        List<String> list = vct.subList(2, 4);
        System.out.println("Sub List: "+list);

  }

}

Output:

Actual vector:[India, Autralia, New Zealand, England, New Delhi]
Sub List: [New Zealand, England]

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site.
I welcome and value your comments, suggestions and corrections.

469total visits,3visits today

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site. I welcome and value your comments, suggestions and corrections.