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 Multithreading, What is wrong with this code?
Tags: ,

11: ♥ Coding Scala Way – Actors with Akka – part 1

We already saw in Java: Producer and Consumer Java Multi-threading code. This extends the tutorial “Simple Akka tutorial in Scala step by step” for setting up the environment with right plugins and libraries with Eclipse & Maven. The Akka Actors sending & receiving messages Akka Actors conceptually each have their

Read more ›

Posted in Scala way of coding
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, 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: ,

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 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:
Page 1 of 3123

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

open all | close all

200+ Java FAQs – Quick Prep

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

open all | close all