Results 1 to 2 of 2
  1. #1
    katie is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default help with protected method in vector class

    How can I use protected method in vector class?
    I want to use RemoveRange() method in Vector class.
    can you send me sample code?
    thanks

  2. #2
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Posts
    130
    Rep Power
    0

    Default

    try :
    Java Code:
    import java.util.*;
    class Testing extends Vector
    {
      public Testing()
      {
        String[] str = {"a","b","c","1","2","3"};
        Vector vec = new Vector(Arrays.asList(str));
        for(int x = 0; x < vec.size(); x++) System.out.println((String)vec.get(x));
        vec.subList(2,4).clear(); //<-------------------------
        for(int x = 0; x < vec.size(); x++) System.out.println((String)vec.get(x));
      }
      public static void main(String[] args){new Testing();}
    }

Similar Threads

  1. Calling a method in another class
    By uncopywritable in forum New To Java
    Replies: 9
    Last Post: 10-22-2012, 04:01 PM
  2. How to use sleep method of the Thread class
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:42 PM
  3. Calling method from another class
    By asahli in forum New To Java
    Replies: 1
    Last Post: 12-15-2007, 06:24 PM
  4. Replies: 1
    Last Post: 08-07-2007, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •