Please forward this error screen to 192. Please forward this error screen second interview questions and answers pdf sharedip-10718057119. Tutorials and Interview questions for Java, data structures, algorithms, programming, coding, FIX Protocol, Tibco RV, UNIX,SQL,books,certifications.
Java collections questions are important part of any core java interview. Core Java Interview yet a tricky one. Together Collection and multithreading make any Java interview tough to crack and having a good understanding of Collection and threads will help you to excel in Java interview. Though I have shared several questions individually in between. In this article, we will see a mix of some beginners and advanced Java Collection interviews and their answers which have been asked in various Core Java interviews. These Java Collection framework interview questions have been collected from various friends and colleagues and Answers of these interview questions can also be found by Google.
Since collection is made of various data structures e. Map, Set and List and there various implementation, mostly interviewer checks whether interviewee is familiar with basics of these collections or not and whether he knows when to use Map, Set or List. Based on Role for which interview is going on questions starts with beginner’s level or more advanced level. Normally 2 to 3 years experience counted as beginners while over 5 years comes under advanced category, we will see questions from both categories.
This collection interview questions is mostly asked during AVP Role interviews on Investment-Banks and has a lot of follow-up questions based on the response of interviewee e. For explanation and answers of these questions Please see earlier link. Queue is used to remove the object and returns the head of the queue, there is a subtle difference between them. What is the difference between fail-fast and fail-safe Iterators? Collection either by adding, removing or modifying objects on underlying collection. They are called fail-fast because they try to immediately throw Exception when they encounter failure.
How do you remove an entry from a Collection? You can use any of these method to remove an entry from Collection, while not iterating. Things change, when you iterate. This method removes current element from Iterator’s perspective. What is the difference between Synchronized Collection and Concurrent Collection?
Java 5 has added several new Concurrent Collection classes e. Interview questions on Java Collection even trickier. Java Also provided a way to get Synchronized copy of collection e. One Significant difference is that Concurrent Collections has better performance than synchronized Collection because they lock only a portion of Map to achieve concurrency and Synchronization. See the difference between Synchronized Collection and Concurrent Collection in Java for more details.
What is the difference between Iterator and Enumeration? What do you need to do to use a custom object as a key in Collection classes like Map or Set? On the other hand if you are storing a custom object in Sorted Collection e. This is another Classical Java Collection interview asked on beginner’s level and most of Java developer has a predefined answer for this interview questions e. Writer or fewer writers since Map gets locked only during the write operation. What is the difference between Set and List in Java? Another classical Java Collection interviews popular on telephonic round or the first round of interview.
Most of Java programmer knows that Set doesn’t allowed duplicate while List does and List maintains insertion order while Set doesn’t. What is key here is to show the interviewer that you can decide which collection is more suited based on requirements. How do you Sort objects on the collection? Collections which provide several methods for creating synchronized collection and sorting. Sorting is implemented using Comparable and Comparator in Java and when you call Collections.
One more beginner level collection interview questions, this is still very popular and mostly asked in the telephonic round. What is a benefit over Map? Map was added in Java 1. 6, it adds navigation capability to Map data structure.