From the UCertified Mock Exam
The answer to this Following Question is: (4)
But when compiling (2),(3),(4) they Compiled and added an element!...............So why is Answer (4) only the right answer?.........And I need a Good Detailed Explanation Please
Which of the following will successfully create an instance of the Vector class and add an element?
1) Vector v=new Vector(99);
v[1]=99;
2) Vector v=new Vector();
v.addElement(99);
3) Vector v=new Vector();
v.add(99);
4 Vector v=new Vector(100);
v.addElement("99");