Java Method Overriding Interview Questions
In our previous article, we have discussed tricky programming questions based on method overloading. However, Method overriding programming questions are more interesting and requires depth understanding of the concept than that of method overloading. Before moving to programming questions, lets understand the basic concepts of method overriding. Method Overriding Using method overriding, child class can […]
Java Method Overloading Interview Questions
After interviewing large set of candidates, we have come to conclusion that most of them fail to satisfactory explain basic OOPs concepts like difference between abstraction and encapsulation, static binding vs dynamic binding, co-varient return types, access modifiers scoping and checked exception handling in method overriding and overloading. Even if they are able to explain it well, interviewer […]
Marker Interface Interview Questions
The interface in java is a mechanism to achieve abstraction and it is one of the most discussed topic in entry and mid level java developer interviews. In our previous articles, we have seen various interface related topics like Interface Evolution in Java, Difference between interface and abstract class and Functional interface in java 8. In this post, we are going to […]
What is magic number CAFEBABE in java class file?
Java Compiler compiles a java source code into bytecode and stores it into .class file which will then get executed by JVM. Everybody knows about it. But do you know each class file in Java starts with magic number CAFEBABE? compelling, isn't it? 😀 After reading this article, you will be able to answer below questions: […]
Find from where java class is loaded | Class Loader SubSystem
In previous article, we discussed about 3 activites of Class Loader SubSystem i.e. Loading, Linking, Initialization and its Types of Class Loader i.e. Bootstrap Class Loader or primordial Class Loader, Extension Class Loader, Application Class Loader or System Class Loader. We have also seen how these Class loader uses Delegation hierarchy algorithm to load Classes into memory area. In this article we'll discuss more about Class Loader and how […]
What is optional and why it is there? | Java8
Have you ever been tired of putting null checks all over the code to avoid any unnecessary NullPointerExceptions. Java 8 has introduced a new class Optional in java.util package. It is used to represent a value is present or absent. The main advantage of this new construct is that No more too many null checks and NullPointerException. It avoids […]
Trapping Rain Water | Algorithm Problem
In this article, we are going to solve the trapping water problem. This kind of problems are asked very frequently in interviews and online programming challenges. Problem Statement We need to find the maximum volume of water that can be stored in between buildings or bars as shown in the below image. Assume that width of each […]
Merge Sort | Sorting Algorithm
Merge Sort is a Divide and Conquer algorithm. Divide and conquer algorithms divide the original data into smaller sets of data to solve the problem. During the Mergesort process, the elements of the array or collections are divided into two parts. To split an array, Mergesort will take the middle element of the array and split the […]
Bubble Sort | Sorting Algorithm
In Bubble sort, each element is compared with its adjacent element. If the first element is smaller than the second one, then the positions of the elements are interchanged, otherwise it is not changed. Then next element is compared with its adjacent element and the same process is repeated for all the elements in the array […]
Performance Issue with HashSet RemoveAll() method
In our previous article on HashSet internals, we have seen internal implementation of its add(), remove(), contains(), clear(), iterator() and isEmpty() methods. One of our readers has raised question about How efficient is HashSet removeAll() method? As it requires detailed explanation, we have decided to write separate article on it. What does removeAll() method do? Before going into internals of […]