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


Please Help Members By Posting Answers For Below Questions

Why volatile is used in java?

530


When can you say a graph to be a tree?

637


Is string is a keyword in java?

547


Is java free for businesses?

587


Can a variable be local and static at the same time?

542






What is a method vs function?

558


Print Vertical traversal of a Binary Tree.

605


What is instance synchronization?

543


Can inner class final?

633


Which is the best sorting technique in java?

523


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

507


What are the concepts of 'OOPS'?

600


How to create a custom exception?

572


We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.

1484


What is a java developer salary?

544