Saturday 12 August 2017

Ten common java interview question


Today I am going to share with my readers the ten commonly asked interview questions in java interview. These questions are based on survey that I conducted on my friends who were attending interview of different companies.

This survey was conducted majorly on candidates having 1-4 years of experience in java.

Iterator is considered fail-fast as it will fail immediately if it feels that the Collection on which it is iterating currently is about to get modified by self/another thread. Here modification means addition, deletion or updating of element. And this modification may result in non-deterministic behavior at an undetermined time in future. In such cases, iterator fails by throwing  ConcurrentModificationException. Click to learn more with example

String is immutable. A detailed explanation citing the reason behind this immutability is already written in this article




We know String is immutable in java. So to perform modification on String we use either StringBuffer or StringBuilder. Though they perform same task but still they differ on certain parameters. Lets check out the difference here



This is one of the most frequently asked java interview question. You will use either of them while coding number of times.
So lets take a walk through to the difference between the two.

First thing that you should be aware of is that both are used to compare two objects. But this question is generally asked in relation to String because each of them when used to compare String Objects behaves differently. Lets see the detailed explanation here

Array list and Linked list both implements list interface. Now if you have to use one then which one will you prefer. For this we have to think about the number of elements we have to insert or delete from the list, memory consumption, which will help in searching the element faster, etc. Click to read more...

No comments:

Post a Comment

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you are looking for a reference book on java then we recommend you to go for → Java The Complete Reference
Click on the image link below to get it now.