How can I retrive only IntegerObjects from a vector in which I stored all types of objects

Showing Answers 1 - 1 of 1 Answers

The example code may help you out.

Vector v = getDataVector();

//getDataVector() may be some method where you will put all your objects into vector.

int size = v.size();

for(int i = 0 ; i<size ; i++){

          Object obj = v.elementAt(i);

          if( obj instanceof Integer){

                 //dosomething

          }else{

                //dosomething else

           }

}

Chandan.P.R

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions