Blog Archives

♥♦ HashMap & HashSet and how do they internally work? What is a hashing function?

HashMap & HashSet are not only one of the frequently used data structures, but also one of the popular interview topics. Q1. How does a HashMap store data? A1. As key/value pairs. You can store and retrieve values with the keys. Q2. What is the HashMap lookup time in Big

Read more ›

Posted in Collection and Data structures, Objects, Understanding Core Java
Tags: ,

♥ Converting a BST Tree to a List in Java

This is the reverse of Converting an Array/List to BST in Java. It is a very common task to convert a collection type A to B as a developer. More examples to practice: Converting from A to B There are 3 ways to traverse a tree to flatten it to

Read more ›

Posted in Converting from A to B
Tags:

03: ♥♦ Java autoboxing & unboxing benefits & caveats interview Q&As

Q1. What do you understand by the terms “autoboxing” and “autounboxing” in Java? A1. Java automatically converts a primitive type like “int” into corresponding wrapper object class Integer. This is known as the autoboxing. When it converts a wrapper object class Integer back to its primitive type “int”, it is

Read more ›

Posted in Data types, Understanding Core Java
Tags: ,

♥♦ Java Generics in no time “? extends” & “? super” explained with a diagram

Generics in Java can be be a bit tricky to get your head around. Hope the explanation below enhances your understanding of generics. This complements 3 scenarios to get a good handle on Java generics. Plain old List, List <Object>, and List<?> The plain old List: is a heterogeneous mixture

Read more ›

Posted in Generics, Understanding Core Java
Tags: ,

♥ Beginner array coding problems in Java

More Data Structure and Algorithms Coding Questions and answers in Java. Q1. Write a program that allows you to create an integer array of 5 elements with the following values: int numbers[ ]={5,2,4,3,1}. The program computes the sum of first 5 elements and stores them at element 6, computes the

Read more ›

Posted in Array Structure
Tags: ,

♥ Finding the missing numbers Java example

Q. Can you write code to identify missing numbers in a given array of numbers? Solution 1: Assuming that the given numbers are in order

Output:

The above solution assumes that the numbers are in order (i.e. sorted). What if the numbers are random? Solution 2: Numbers are

Read more ›

Posted in Can you write code?
Tags:

♥ ♦ Java coding practice problems – prime and powerful

There is no other way to pass the Java coding tests other than practicing. I have failed Java coding tests due to lack of practice. How often do you get work with tree and graph data structures? Ho often do you work with algorithms? 50+ Java coding practice problems Links:

Read more ›

Posted in Algorithms, Can you write code?
Tags: ,

♥♦ 13 FAQ Java Collection interview questions and answers on differences between X and Y

Java Collection interview questions and answers and Java String class interview Q&As are must know and you can’t write any decent Java application without these 2 APIs. Q1. What are differences between Enumeration and Iterator? A1. Enumeration is old and it’s there from JDK1.0 whereas iterator is newer. The key

Read more ›

Posted in Collection and Data structures, Differences Between X & Y
Tags: , ,
Page 1 of 3123

600+ Java Interview Q&As ♥Free|♦FAQ

open all | close all

200+ Java Interview FAQs – Memory Joggers

open all | close all

16 Java Key Areas to be a top-notch

open all | close all

80+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your "Career Skills"?

open all | close all