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 a package in java? List down various advantages of packages.

0 Answers  


what are the methods of an object class?

3 Answers  


Name some OOPS Concepts in Java?

0 Answers  


What restrictions are placed on method overloading?

0 Answers  


Explain the purpose of garbage collection in Java?

0 Answers   BirlaSoft,


what is a thread pool in java and why is it used?

0 Answers  


How many wrapper classes are there in java?

0 Answers  


what is the Use of throws exception?

2 Answers  


What is a methodologist?

0 Answers  


What is the method in java?

0 Answers  


Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?

0 Answers  


What is the char data type?

0 Answers  


Categories