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 "finally" keyword?

10 Answers  


Difference between static methods, static variables, and static classes in Java.

1 Answers  


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

1 Answers  


Can a abstract class be declared final?

1 Answers  


What are the access modifiers available in java?

1 Answers  


Can an interface extend a class?

1 Answers  


What is identifier with example?

1 Answers  


What is Overriding and how can it be used?

7 Answers   Consagous, Wipro,


How would you convert bytes to string?

1 Answers  


How do you use find and replace?

1 Answers  


What is busy spin, and why should you use it?

1 Answers  


Is java a software?

1 Answers  


Categories