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

Define max and min heap, also the search time of heap.

0 Answers   GrapeCity,


What is the difference between this() and super() in java?

0 Answers  


If two threads call a static method at the same point of time, what will happen?

3 Answers   KPIT,


What are different access specifiers in java?

0 Answers  


What is a marker interface?

0 Answers  






Why we use methods in java?

0 Answers  


What is externalizable interface?

0 Answers  


10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile? a)Direction d = NORTH; b)Nav.Direction d = NORTH; c)Direction d = Direction.NORTH; d)Nav.Direction d = Nav.Direction.NORTH;

2 Answers  


Where can I find data structures question and answers with comprehensive working code written in Java

0 Answers   Amazon,


Explain, why the constructor is required in implemented class?

4 Answers  


Does constructor be static?

0 Answers  


How do you square a number?

0 Answers  


Categories