Thanks
Prabhudatta
Campbell Ritchie wrote:. . . and have you read what it says in the Java Language Specification about what members an array has? Or the documentation for toString()? When you have read them, it should be obvious why you are getting that output.
Thanks
Prabhudatta
Ranganathan Kaliyur Mannar wrote:And please use Code Tags when posting java code.
Thanks
Prabhudatta
Somebody has added code tags . . . but they don't work because they haven't indented the code.Jesper de Jong wrote:Code tags do not look like [CODE STARTS] and [CODE ENDS], but like this:
[code]
... put your code here
[/code]
Have you read both those links?I, earlier wrote:. . . and have you read what it says in the Java Language Specification about what members an array has? Or the documentation for toString()? When you have read them, it should be obvious why you are getting that output.
Campbell Ritchie wrote:
Have you read both those links?I, earlier wrote:. . . and have you read what it says in the Java Language Specification about what members an array has? Or the documentation for toString()? When you have read them, it should be obvious why you are getting that output.
And have you read about the Vector#toString() method?
I know what the answer to your problem is, but it will do you no good if I simply tell you. If you have read those links and not understood them, then we are only to happy to try to help you understand, but, as it says on the "Beginning Java" home page, we do not simply give out such answers.
Thanks
Prabhudatta
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie wrote:Rob is right to go on about toString().
Like most beginners, you have put lots of code in which you don't actually need. You can for example get rid of all the fields, and the loop which you don't need. When you get rid of the compiler errors too, you will actually see your Vector turned into a String. I am a bit surprised you hadn't noticed that earlier.
Why have you used Vector rather than ArrayList?
Why have you used a raw type, rather than giving the List an actual type parameter?
Thanks
Prabhudatta
Rob Spoor wrote:What's wrong with toString()? And more importantly, how do you want the Vector to be turned into a String? As in, what should the String look like?
Thanks
Prabhudatta
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |