write a program to create an arraylist and listeterator.and
value should be enter through keyboard.
Answer Posted / magreal
public static void main(String[] args) {
String str;
List<String> l = new ArrayList();
int i=0;
boolean more = true;
do{
str = TextIO.getln();
l.add(str);
i++;
TextIO.putln("Add new item ? Y/N");
}while(TextIO.getlnBoolean());
for(String s: l){
TextIO.putln(s);
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is core java used for?
How do you break a loop?
What are void pointers?
What access modifiers can be used for methods?
how we can make a read-only class in java?
What is t in generics in java?
What is the Concept of Encapsulation in OOPS
What are the two environment variables that must be set in order to run any java programs?
What does substring mean?
What do you mean by default constructor in java?
Can we assign integer value to char in java?
What is scope & storage allocation of global and extern variables? Explain with an example
What is merge sort in java?
Realized?
What is the difference between ArrayList and Vector? which one is better in Java