In Marcus Green's
applet exam he has a question:
---
Number:47---
Which of the following is[sic] will sucessfully[sic] create an instance of the Vector class and add an element;[sic]
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");
The answer given is
4 The addElement function takes
Object as a parameter. So I'm assuming that all string literals "" are automatically 4(
implicitly)paired with a String reference object. Otherwise shouldn't two and three be valid answers as well?
Thanks again,
Khalid
[This message has been edited by Khalid Bou-Rabee (edited July 17, 2000).]