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 serialization in java?
How to stop a thread in java? Explain about sleep () method in a thread?
What is the benefit of lambda expressions?
How are destructors defined in java?
What is the output of the below java program?
Explain about anonymous inner classes in java?
What is the this keyword?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
What is immutability in java?
Can an interface have a constructor?
Is a class subclass of itself?
What causes memory leak in java?
Can we override compareto method?
What is try-with-resources in java?
What are reference variables in java?