write a program to create an arraylist and listeterator.and
value should be enter through keyboard.



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

Post New Answer

More Core Java Interview Questions

What is the memory leak in java?

0 Answers  


What is meant by distributed application? Why are we using that in our application?

0 Answers  


what is the difference between String s="hello"; and String s=new String("hello");?

3 Answers  


Can a class be declared as protected?

0 Answers  


Explain when noclassdeffounderror will be raised ?

0 Answers  






There can be a abstract class without abstract methods, but what is the need to declare a class abstract if it doesn't contain abstract methods?

5 Answers   HCL,


What is immutability in java?

0 Answers  


What is adapter in java?

0 Answers  


Why we cannot override static method?

0 Answers  


What is difference between variable declaration and definition?

0 Answers  


why using interface interface ?

0 Answers  


What is the use of arrays tostring () in java?

0 Answers  


Categories