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

Answer Posted / magreal

public static void main(String[] args) {

String str;
Vector<String> v = new Vector<String>();
do{
str = TextIO.getln();
v.add(str);
TextIO.putln("Add the item ? Y/N");
}while(TextIO.getlnBoolean());

for(String s: v){
TextIO.putln(s);
}
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why are the destructors for base class and derived class called in reverse order when the program exits

1701


What is size () in java?

540


What are constants and how to create constants in java?

552


Does sprintf allocate memory?

591


Differentiate between overriding and overloading cases?

590






Is 0 true or is 1 true?

514


What is update method called?

655


Which is fastest collection in java?

557


What one should take care of, while serializing the object?

482


Which is better stringbuilder or stringbuffer?

525


How many bits is a boolean?

618


What is a line break?

578


What are alternatives to java serialization?

596


How many bytes is a char in java?

522


What are measurable parameters?

562