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

Differentiate between vector and array list.

0 Answers  


What is method reference in java?

0 Answers  


What are the characteristics provided in jdk1.6 apart from other versions?

3 Answers   TCS,


How do you relate a Interface to a Class? Tell me in Detail?

4 Answers  


How do you compare two objects?

0 Answers  






What are anonymous inner classes?

0 Answers  


Explain public static void main(string args[]) in java.

0 Answers  


Write an algorithm program in java for the following question.. 1) S is a set of integers.X is an integer obtained by sum of two digits in S. Write logic for whether or not the X is from the S. The time of algorithm should not exceed o(n logn).

0 Answers  


why java does compile time polymorphism at run time ?

6 Answers   CTS, TCS,


What are virtual functions?

2 Answers  


what is recursion in java

0 Answers   Cap Gemini,


How do you convert string to int in java?

0 Answers  


Categories