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 |
What is the memory leak in java?
What is meant by distributed application? Why are we using that in our application?
what is the difference between String s="hello"; and String s=new String("hello");?
Can a class be declared as protected?
Explain when noclassdeffounderror will be raised ?
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?
What is immutability in java?
What is adapter in java?
Why we cannot override static method?
What is difference between variable declaration and definition?
why using interface interface ?
What is the use of arrays tostring () in java?