Q) I have a ArrayList object, in that object i have added 5
integer values, 5 float values, 5 string values. Now
question is how can delete particular type of data ( i.e all
int values or all float values or string values) in that
list object at a time?
Answer Posted / murli
for(int i=0;i<arr.size();i++){
if(arr.get(i) instanceof Integer)
arr.remove(i);
}
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What are the benefits of java?
Explain the difference between protected and default access.
Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
What is the difference between serializable and externalizable interface?
Is char * a string?
What is the difference between a scrollbar and a scrollpane?
When is the arraystoreexception thrown?
Which is dependent variable?
why not override thread to make a runnable? : Java thread
What is the difference between double and float variables in java?
List the three steps for creating an object for a class?
what is meant by Garbage collection?
Can we pass null as argument in java?
Explain implementation and how is it different from conversion?
How many arguments can be passed to main ()?