480 Core Java Interview Questions (Part 3)

This guide having 480 Core Java interview questions will help you in revising most asked core java interview questions for both junior and senior developers.

480 Core Java Interview Questions (Part 3)

201.What are the similarities between a HashSet and a HashMap in Java?
202.What is the reason for overriding equals() method?
203.How can we synchronize the elements of a List, a Set or a Map?
204.What is Hash Collision? How Java handles hash-collision in
HashMap?
205.What are the Hash Collision resolution techniques?
206.What is the difference between Queue and Stack data structures?
207.What is an Iterator in Java?
208.What is the difference between Iterator and Enumeration in Java?
209.What is the design pattern used in the implementation of Enumeration
in Java?
210.Which methods do we need to override to use an object as key in a
HashMap?
211. How will you reverse a List in Java?
212.How will you convert an array of String objects into a List?
213.What is the difference between peek(), poll() and remove() methods
of Queue interface in java?
214.What is the difference between Array and ArrayList in Java?
215.How will you insert, delete and retrieve elements from a HashMap
collection in Java?
216.What are the main differences between HashMap and
ConcurrentHashMap in Java?217.What is the increasing order of performance for following collection
classes in Java?
218.Why does Map interface not extend Collection interface in Java?
219.What are the different ways to iterate elements of a list in Java?
220.What is CopyOnWriteArrayList? How it is different from ArrayList
in Java?
221.How remove() method is implemented in a HashMap?
222.What is BlockingQueue in Java Collections?
223.How is TreeMap class implemented in Java?
224.What is the difference between Fail-fast and Fail-safe iterator in
Java?
225.How does ConcurrentHashMap work in Java?
226.What is the importance of hashCode() and equals() methods?
227.What is the contract of hashCode() and equals() methods in Java?
228.What is an EnumSet in Java?
229.What are the main Concurrent Collection classes in Java?
230.How will you convert a Collection to SynchronizedCollection in Java?
231.How IdentityHashMap is different from a regular Map in Java?
232.What is the main use of IdentityHashMap?
233.How can we improve the performance of IdentityHashMap?
234.Is IdentityHashMap thread-safe?
235.What is a WeakHashMap in Java?
236.How can you make a Collection class read Only in Java?237.When is UnsupportedOperationException thrown in Java?
238.Let say there is a Customer class. We add objects of Customer class
to an ArrayList. How can we sort the Customer objects in ArrayList by
using customer firstName attribute of Customer class?
239.What is the difference between Synchronized Collection and
Concurrent Collection?
240.What is the scenario to use ConcurrentHashMap in Java?
241.How will you create an empty Map in Java?
242.What is the difference between remove() method of Collection and
remove() method of Iterator?
243.Between an Array and ArrayList, which one is the preferred
collection for storing objects?
244.Is it possible to replace Hashtable with ConcurrentHashMap in Java?
245.How CopyOnWriteArrayList class is different from ArrayList and
Vector classes?
246.Why ListIterator has add() method but Iterator does not have?
247.Why do we sometime get ConcurrentModificationException during
iteration?
248.How will you convert a Map to a List in Java?
249.How can we create a Map with reverse view and lookup in Java?
250.How will you create a shallow copy of a Map?
251.Why we cannot create a generic array in Java?
252.What is a PriorityQueue in Java?
253.What are the important points to remember while using Java
Collections Framework?254.How can we pass a Collection as an argument to a method and ensure
that method will not be able to modify it?
255.Can you explain how HashMap works in Java?
256.Can you explain how HashSet is implemented in Java?
257.What is a NavigableMap in Java?
258.What is the difference between descendingKeySet() and
descendingMap() methods of NavigableMap?
259.What is the advantage of NavigableMap over Map?
260.What is the difference between headMap(), tailMap() and subMap()
methods of NavigableMap?
261.How will you sort objects by Natural order in a Java List?
262.How can we get a Stream from a List in Java?
263.Can we get a Map from a Stream in Java?
264.What are the popular implementations of Deque in Java?
Advanced Multi-threading
265.What is a Thread in Java?
266.What is the priority of a Thread and how it is used in scheduling?
267.What is the default priority of a thread in Java?
268.What are the three different priorities that can be set on a Thread in
Java?
269.What is the purpose of join() method in Thread class?
270.What is the fundamental difference between wait() and sleep()
methods?
271.Is it possible to call run() method instead of start() on a thread inJava?
272.What is a daemon thread in Java?
273.How can we make a regular thread Daemon thread in Java?
274.How will you make a user thread into daemon thread if it has already
started?
275.Can we start a thread two times in Java?
276.What is a Shutdown hook in Java?
277.What is synchronization in Java?
278.What is the purpose of Synchronized block in Java?
279.What is static synchronization?
280.What is a Deadlock situation?
281.What is the meaning of concurrency?
282.What is the main difference between process and thread?
283.What is a process and thread in the context of Java?
284.What is a Scheduler?
285.What is the minimum number of Threads in a Java program?
286.What are the properties of a Java thread?
287.What are the different states of a Thread in Java?
288.How will you set the priority of a thread in Java?
289.What is the purpose of Thread Groups in Java?
290.Why we should not stop a thread by calling its stop() method?
291.How will you create a Thread in Java?292.How can we stop a thread in the middle of execution in Java?
293.How do you access the current thread in a Java program?
294.What is Busy waiting in Multi-threading?
295.How can we prevent busy waiting in Java?
296.Can we use Thread.sleep() method for real-time processing in Java?
297.Can we wake up a thread that has been put to sleep by using
Thread.sleep() method?
298.What are the two ways to check if a Thread has been interrupted?
299.How can we make sure that Parent thread waits for termination of
Child thread?
300.How will you handle InterruptedException in Java?

Continue with 480 Core Java interview questions (Part 4)

Leave a Comment

*

Please share it if you found this useful
Hide Buttons