How to Remove Entry (key/value) from HashMap while Iterating? Example Tutorial

Can you remove a key while iterating over HashMap in Java? This is one of the interesting interview questions as well as a common problem Java developer face while writing code using HashMap. Some programmer will say No, you cannot remove elements from HashMap while iterating over it. This will fail fast and throw concurrent modification exception. They are right but not completely. It's true that the iterator of HashMap is a fail-fast iterator but you can still remove elements from HashMap while iterating by using Iterator's remove() method. This is the same technique which we have used in past to remove elements while iterating over a List in Java. The key here is not to use the remove() method from Map or List interface to avoid java.util.ConcurrentModfiicationException in Java.

39 Java J2EE Support Engineer Interview Questions with Answers

I have shared many posts about Java interview question in the past but nothing, particularly for support engineer perspective. Since there are a lot of L1 and L2 support job exists in BFSI (Banking, Finance, and Insurance Industry) and they are also for the longer term, I decided to write this post. When you go for a support engineer role, especially for Java application be it to core Java or Java EE application, Interviewer expects you know basics of Java and can start/stop the application, see log files, alert developers, and other aspects of the support e.g. opening conference bridge to solve production issues, communicating to stakeholders, and involving right peoples. In this article, I will share questions to help with technical aspects e.g. the essential skills you need to clear a support engineer interview.

5 Difference between an array and linked list in Java

The difference between an array and linked list is one of the frequently asked data structure and algorithm interview question and you might have seen it before on your telephonic or face-to-face interview. It is also very popular question during practical exams on Computer Science degree courses e.g. B.E. and B.Tech. It's very simple and easy to answer but you just can't afford to miss this question on an interview. Both array and linked list are two of the most popular and fundamental data structure in Computer Science and Programming, and Java supports both of them. One of the traits of a good programmer is extensive knowledge of data structure and algorithm and that's why it's very important for you to learn the difference between array and linked list data structure and understand when to use an array over linked list and vice-versa. Though this discussion is valid from C/C++ and other programming language perspective, I'll give you examples and explanation in Java.

Can you make a class Static in Java?

This is one of the tricky questions in Java because there is no straight forward Yes and No answer here. You cannot make a top level class static in Java but Yes, you can make a nested class static in Java. In fact, it is even advised (see Effective Java) to prefer a nested static class in Java than normal inner classes. Now, the question comes what is a top level class and what is a nested class in Java? Well, you can declare multiple classes in a single Java source file. A class is said to be top level if it is not inside any other class and a class which is inside another class is known as nested class. You can create nested class inside another top level or another nested class in Java. This is the class which can be static in Java.

Counting Sort in Java - Example

The Counting sort algorithm, like Radix sort and bucket sort, is an integer based algorithm (i.e. the values of the input array are assumed to be integers). Hence counting sort is among the fastest sorting algorithms around, in theory. It is also one of the few linear sorting algorithm or O(n) sorting algorithm. It's quite common in Java interviews nowadays to ask, whether do you know any O(n) sorting algorithm or not. If you face this question in future, you can mention Radix sort, bucket sort, or counting sort algorithms.  How does counting sort algorithm works? Well, counting sort creates a bucket for each value and keep a counter in each bucket. Then each time a value is encountered in the input collection,  the appropriate counter is incremented.

99 Angular JS Interview Questions for Web Developers

The AngularJS is one of the popular JavaScript frameworks, I think most popular after jQuery, with the core goal of simplification. It allows building dynamic, single page web apps (SPAs) using JavaScript and supports the Model View Controller (MVC) programming structure. It has used widely and even big companies like Google, Virgin America, and HBO are using Angular JS to build their site. The demand for web developers is on all time high and there is a huge demand for developers who understand modern JavaScript frameworks e.g. Angular JS, jQuery, Facebook's React JS etc. The Angular JS is Open-source, front-end JavaScript framework which is developed by Google, it mainly competes with Facebook's ReactJS framework.