• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interview Question & help in Vector,HashMap & ArrayList  RSS feed

 
divya sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you please send me some link where I could study "Vector", "HashMap" & "ArrayList" for me it's very diffcult.

Also, I need Java interview questions.

 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The classes: Vector & ArrayList are concrete classes tha implement the Collection interface. Both Vector and ArrayList are very much like the arrays that are built into the Java Language. The difference is that Collections, including Vector and ArrayList are more dynamic. They automatically grow and shrink to fit the number of elements that you have in the Collection.

In Java 5, Collections began having an optional element type called generics. This gives Collections (and some othr classes) an option to be more strongly typed than using the Object class for all elements as you had to do with Java 4 and earlier.

For a link on Collection & Maps in Java 5, see:

Sun's Tutorial On Collections & Maps

In the class HashMap, instead of each element storing a single object, there are two object, a key and a value. The key is used to determine where the element will be stored internally in the Map. The value is the object that you want to store in the Map. The advantage of Maps is that you can retrieve values very quickly, using the key (if you do it right).

I'm still learning about Map and HashMap myself, but I think that to make it work right, you need to override hashCode() for the key class and override equals() for the value class.

Kaydell
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To prepare for a job interview:

1. you should be clear on why some classes are abstract and some are concrete. You should know what to do to make an abstract concrete so that you can instantiate it.

2. You should know what interfaces are and how they are like abstract classes and how they are different.

3. You should know that you can declare an object reference variable as an superclass or an interface and that the referenced object need only be a subclass or a class that implements the interface.

4. You should know how parameter-passing works in Java.

My job interview was two hours long. I prepared by reading Core Java Volume I & Volume II 7th edition. This was for a desktop programming job so these books covered Java SE 5.0 which was all that I needed. For Java EE 5.0, I think that Cameron McKenzies book on SCJA is good because it is a good overview of all of Java.

Kaydell
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!