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 constructor and its types?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
Can an abstract class be a final class?
What are the various access specifiers for java classes?
What are register variables what are the advantages?
What is stream api in java8?
What are different types of multitasking?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is yield () in java?
Differentiate between class and structure.
When will we use them?
What is a variable and constant?
What is use of set in java?
Explain method overloading?
What are the principle concepts of oops?