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 is instanceof operator used in java?
Explain about the main() method in java?
Can we access instance variables within static methods ?
What is the super void?
What are static blocks in java ?
What is a method in programming?
What is a cup of java?
According to java operator precedence, which operator is considered to be with highest precedence?
Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.
What is the size of int in 64-bit jvm?
What is a parameter used for?
Write code of any action class?
Can you override a final method?
Why synchronization is important?
What is meant by final class?