aspose file tools*
The moose likes Beginning Java and the fly likes please clarify my doubts in Vectors? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please clarify my doubts in Vectors?" Watch "please clarify my doubts in Vectors?" New topic
Author

please clarify my doubts in Vectors?

Raja seemakurthi
Greenhorn

Joined: Jun 28, 2007
Posts: 17


i got this question from the following URL.
http://www.valoxo.ch/jr/mocks/mock01a.html

we can use add() for adding objects like Integer,Float class into Vector. According to my knowledge the output should be [1,2,0,2].
Am i wrong? please guide me.

Thanks,
Raja
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
Please tell us where the question is from We don't simply hand out that sort of answer; please explain how you think the question works, by going through the exercise line by line.
Tekchand Prasad
Ranch Hand

Joined: Oct 20, 2005
Posts: 32
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
Tekchand Prasad, thank you for replying, but please don't simply give the explanation. It does the original poster no good; it is much better if they work it out for themselves. Please have a look at this FAQ, as well as the heading of the beginner's forum page. Please don't be annoyed with me, but I have deleted the code copied with the little explanations.
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Hi Raja,

Why do you expect that? Have you tried that code?
You are right, the add method allow you to add Objects to the Vector, anyway, take a look at the Vector javadoc, it will help you a lot!!

http://java.sun.com/j2se/1.5.0/docs/api/
Raja seemakurthi
Greenhorn

Joined: Jun 28, 2007
Posts: 17
let me say sorry for asking this kind of question.
i have gone through the API and read the related functions used in the code.
i ran the file and understood the output.

Anyways thanks for your comments and help also.
wish me all the best for certification exam.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
Well done working it out. No need to say sorry; you were quite right to ask that sort of question. But we should still see where the question was from.
Raja seemakurthi
Greenhorn

Joined: Jun 28, 2007
Posts: 17

I got this question from the following URL.
http://www.valoxo.ch/jr/mocks/mock01a.html

Already i put this link in my first request itself.
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
You should post your answer/findings for others to stumble on. Thanks and glad you found the answer.


SCJA
~Currently preparing for SCJP6
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: please clarify my doubts in Vectors?