problems with semantics and keywords.
Posted on 2000-01-23
I have the following lines of code with which I think there are a few problems to do with adding elements into a Vector:
Vector v = new Vector();
String s = "ABCD";
for(int i = 0; i< s.length() i++)
v.add(0, s.substring (i, i +1));
Please tell me what the problem with the v.add is and what would the final vector look like once the for loop has finished looping?
Also what is wrong with this lines of code:
String x = " ";
x += s.substring(2,5);
Does the += operator exist, and if so what does it do?
Does x need a variable type assinged to it?
Thanks for your help!