It can be seen in the output, that the format of v3 with System.out.println("v3 = " + v3); as indicated on line 16, is different as to the digits compared to v1 and v2. What would be the impact of having v3 in this way in comparison to v1 and v2? And also, what is the meaning of the symbols ^T, in the output, at the end of v1, v2 and a?
The question is from myself, I am studying to understand how to print out vectors and calculate scalar products between vectors. This Vector class has been provided to me from my instructor, there is no other source from books at the moment.
You can see the print method prints the text you pass to it, followed by the i elements of the array, each occupying 12 spaces with 5 after the decimal place, then ^T. If you don’t put values into the array, then they default to 0, displayed as 0.00000.
Does your Vector class have a toString() method? If you try System.out.println(v); you will there invoke the unoverridden version from Object.