Hi prosper:
Let me say that you are a very observant person. Well, you are right, those lines in the tutorial has an error and can confuse the user. First, the line:
would compile depending on the "a" array declaration, where the type of the elements of the array should have a times() method defined (Object doesn't have such method). Anyway, the next example with vectors:
v.setElementAt(v.elementAt(j).times(v.elementAt(k)), i);
would NEVER compile!, because the elementAt() method returns an Object which have no times() method defined. So if you don't explicitly cast the returned value it wont compile. It should be:
v.setElementAt(((ClassWithTimesMethodDefined)v.elementAt(j)).times(v.elementAt(k)), i);
If you find that "ClassWithTimesMethodDefined" class please let me know. I have heard about that method but I cant remember where. Certainly it is not an Object method.
Hope it helps.
Pedro Andrés Solorzano
Pontificia Universidad Javeriana
Bogotá, Colombia, SurAmérica.
Let me know if this post have actually helped you, by clicking the purple star.