Category: Question and Answer

Interview Question Access Modifiers in Java

Access Modifiers in Java

Access Modifiers in Java As the name suggests access modifiers in Java helps to restrict the scope of a class, constructor , variable , method or data member. There are four types of access modifiers available in java: Default – No keyword required Private Protected Public Default: When no access modifier is specified for a …

Read Article Read More

Interview Question Internal working of HashMap

Internal working of HashMap

Single statement answer If anybody asks me to describe “How HashMap works?“, I simply answer: “On principle of Hashing“. As simple as it is. Now before answering it, one must be very sure to know at least basics of Hashing. Right?? What is Hashing Hashing in its simplest form, is a way to assigning a unique …

Read Article Read More

Interview Question Design Principles(SOLID)

Design Principles(SOLID)

SOLID is a mnemonic acronym for five principles of object oriented programming or, as I hinted, really just programming in general (except, perhaps for the Liskov Substitution Principle). These concepts have been around since at least the early 2000s and have truly stood the test of time. What you get by following them is code …

Read Article Read More

Coding Interview Question Reverse an array in subset of N

Reverse an array in subset of N

  private int[] reverseArray(int[] A, int k) { for (int i = 0; i < A.length; i += k) { int left = i; // in case right larger than A.length int right = Math.min(i + k – 1, A.length – 1); // reverse sub array while (left < right) { int temp = A[left]; …

Read Article Read More

Interview Question What is difference between Abstraction and Encapsulation?

What is difference between Abstraction and Encapsulation?

Difference between Abstraction vs Encapsulation Here are some of the key difference between Encapsulation and Abstraction in point format for your quick revision: 1) The most important difference between Abstraction and Encapsulation is that Abstraction solves the problem at design level while Encapsulation solves it implementation level. 2) Abstraction is about hiding unwanted details while giving out most essential …

Read Article Read More

Interview Question What is new in java 1.8 feature interface?

What is new in java 1.8 feature interface?

What is new in java 1.8 feature interface? Let’s have a brief look on these Java 8 features. I will provide some code snippets for better understanding, so if you want to run programs in Java 8, you will have to setup Java 8 environment by following steps. Download JDK8 and install it. Installation is simple …

Read Article Read More