What is the difference between add() and addElement()
method in Vector Class ?

Answers were Sorted based on User's Feedback



What is the difference between add() and addElement() method in Vector Class ?..

Answer / sathya


add(int indx, Object e): Inserts the specified element at
the specified position in this Vector.Return type void

add(Object e):Appends the specified element to the end of
this Vector.Return type boolean

addElement(Object obj): Adds the specified component to the
end of this vector, increasing its size by one.Return type void.

Is This Answer Correct ?    19 Yes 3 No

What is the difference between add() and addElement() method in Vector Class ?..

Answer / sandhya sree malladi

This method is identical in functionality to the add
(Object) method (which is part of the List interface).

add(Object ) is due the fact that Vector implements List
Interface and it is appeared since Java 1.2 when Vector was
moved to Collections: The collection classes from earlier
releases, Vector and Hashtable, have been retrofitted to
implement the collection interfaces.

addElement is "original" Vector's method....

Is This Answer Correct ?    16 Yes 4 No

Post New Answer

More Core Java Interview Questions

What is static variable with example?

0 Answers  


What is parsing a sentence?

0 Answers  


Can we sort arraylist in java?

0 Answers  


If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?

0 Answers  


What is natural ordering in java?

0 Answers  






Can we initialize the final blank variable?

0 Answers  


what is polymorphism with example?types of polymorphism?

15 Answers   HP, Sigma Solve,


What is an exception? difference between Checked and Unchecked exception in Java

0 Answers   SkillGun Technologies,


Do I need java on my computer?

0 Answers  


Is java 9 released?

0 Answers  


What is formatted output in java?

0 Answers  


Why do we use predicate in java?

0 Answers  


Categories