write a program to create an arraylist and listeterator.and
value should be enter through keyboard.
Answer / 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 |
Can we create a constructor in abstract class?
Can finally block be used without a catch?
What is the difference between choice and list?
Is it possible to write static method in abstract class? justyfy your answer?
Explain the differences between public, private, protected and static?
Can i have abstract class with no abstract methods?
What is sortedmap interface?
Hi Friends, can you give difference between extending thread class and implementing runnable interface.
Why we go for collections in java?
Can we call thread start () twice?
What are class types in java?
What are the two main uses of volatile in Java?