Blog Archives

02: ♥♦ What is wrong with this code? Heap Vs Stack, Thread safety & Synchronized

This post covers must know Java Multithreading basics – Heap Vs Stack, Thread-safety & Synchronization. When you have a multithreaded Java application, you need to code in a thread-safe manner. Java interviewers may ask you to detect thread-safety issues as discussed in “What is wrong with this code?“. 1.What is

Read more ›

Posted in FAQs Free, Multithreading, What is wrong with this code?
Tags: ,

06: ♥♦ 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, FAQs Free, 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, FAQs Free, Understanding Core Java
Tags: ,

02: ♥♦ 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 5 Java generics interview Q&As with examples. Plain old List, List <Object>, and List<?> The plain old List: is a heterogeneous mixture or a mixed

Read more ›

Posted in FAQs Free, 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: ,
Page 1 of 3123

800+ Interview Q&As – ♥ Free | ♦ FAQs

open all | close all

Pressed for time? 200+ Quick Prep

open all | close all

16 Technical Key Areas to be a top-notch

open all | close all

100+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your

open all | close all