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’s the difference between callable and runnable?

0 Answers  


What is cloneable interface?

8 Answers  


How is object created in java?

5 Answers   Cap Gemini,


What all access modifiers are allowed for top class ?

0 Answers  


What is the purpose of setAutoCommit() ?

1 Answers   Google,






I have a String s = java; What is the output when I say s.replaceAll('j', 'k'); Also what is the value of s after replacing?

8 Answers   KPIT,


when we create singleton design then we create private constructtor..so how JVM take private constructor to make object..but it's private..

1 Answers   Ness Technologies,


can rmi and corba based applications interact ?

0 Answers  


How are this() and super() used with constructors in java programming?

0 Answers  


Can we make constructors static?

0 Answers  


what are upcasting and downcasting?

5 Answers  


What is length in java?

0 Answers  


Categories