800+ Java Interview Questions & Answers for 2 to 5 and 5 to 10+ years of experience & architects

300+ Core Java Interview Q&As

Java freshers to intermediate developers interview questions answered for 2 to 5 years of experience.

300+ Java Interview FAQs

300+ Enterprise Java Interview Questions & Answers

Java intermediate to experienced developer interview questions answered for 2 to 5+ years of experience.

300+ Java EE Q&As

Judging your Java experience

Java programming & Architect interview questions and answers for programmers with 5 to 10 years and plus experience.

Read more ...

500+ Big Data Interview Questions & Answers for 2 to 5 and 5 to 10+ years of experience & architects

50+ Apache Kafka Interview Questions & Answers

20+ Apache Kafka Interview Questions & Answers

250+ Scala Interview Q&As for Data Engineers

Read more ...

27: 50+ SQL scenarios based interview Q&As – identifying consecutive records

The data analysts & engineers will often be faced with the below SQL scenario at work. It is also often asked in job interviews. This solution uses SQL analytical functions & you can learn more about them at SQL analytic functions interview questions – Part 1

Setup the data on db-fiddle MySQL V8.0 to practice.

Q. Given the below input:

How will you write SQL query to output the count of consecutive statuses of jobs? The output should look like:

One typical real life scenario is to raise an alert if there are 3 consecutive job failures.

Set up table & insert data

Solution 1: Using LAG(..)

Read more ...

18 Java scenarios based interview Q&As for the experienced – Part 1

Let’s look at scenarios or problem statements & how would you go about handling those scenarios in Java. These scenarios interview questions will judge your Java experience. Full list of Java scenarios based interview questions are covered at Judging your Java experience via scenarios based interview Q&As.

#1. Caching

Q01.Scenario: You need to load stock exchange security codes with price from a database and cache them for performance. The security codes need to be refreshed say every 30 minutes. This cached data needs to be populated and refreshed by a single writer thread and read by several reader threads. How will you ensure that your read/write solution is scalable and thread safe?

A01. Solution: There are a number of options as described below:

Option 1: The java.util.concurrent.locks package provides classes that implement read/write locks where the read lock can be executed in parallel by multiple threads and the write lock can be held by only a single thread. The ReadWriteLock interface maintains a pair of associated locks, one for read-only and one for writing. The readLock( ) may be held simultaneously by multiple reader threads, while the writeLock( ) is exclusive. In general, this implementation improves performance and scalability when compared to the mutex locks (i.e. via synchronized key word) when

1. There are more reads and read duration compared to writes and write duration.

2.… Read more ...


00: Top 50+ Core Java interview questions & answers for 1 to 3 years experience

Top 50 core Java interview questions covering core Java concepts with diagrams, code, examples, and scenarios. If you don’t get these Java interview questions right, you will not be getting an offer.

== Vs equals(…)

Q1. What is the difference between “==” and “equals(…)” in comparing Java String objects?
A1. When you use “==” (i.e. shallow comparison), you are actually comparing the two object references to see if they point to the same object. When you use “equals(…)”, which is a “deep comparison” that compares the actual string values. For example:

Read more ...

01: 30+ Java architect interview questions & answers – Part 1

One of the very frequently asked open-ended interview questions for anyone experienced is: Can you describe the high-level architecture of a recent application you had worked on? You can be asked:

1) to draw an architectural diagram on a white board and
2) to provide a brief description of the architecture, and
3) to elaborate on decisions, technologies & frameworks used, alternatives considered, pros, cons, challenges, risks, etc ….

Java Application integration styles

Q1. What are the different application integration styles?
A1. Enterprise systems don’t stand-alone. They integrate with many other corporate systems to provide mission critical services to the clients. There are a number of different integration styles like

#1 Shared database

where multiple applications share the same database. This approach is simple, but has disadvantages such as

1) More likely to hit performance & bottlenecks and scalability issues. SQL Databases don’t really scale.

2) Any adjustments (e.g. version upgrade) to the database for one application will have side effects on other applications. Complicates indexing and table partitioning as different applications have different needs.

3) Concurrency & timing issues as there could be chronological dependencies among processes that share the database. What about different applications working on the same tables concurrently? What if one application modifies the data that should have been altered by another application first?

#2 Batch file transfers

Applications will have their own databases, and the data from one application will be copied into another application’s database via an over-night or regular interval batch jobs with an ETL (i.e.… Read more ...


15+ slacknesses or lack of experience that can come back & bite you as an architect, experienced programmer or data engineer

Production issues seek the attention of middle and top level management. Often these are intermittent issues that are harder to reproduce in lower environments without the right know-hows & tools. Some will shrug it off as “Cannot be reproduced“, whilst others will seize the opportunity to showcase their technical strengths & know hows to go places. Here are a few things that you must pay attention as a software developer, designer or architect to prevent any future embarrassments. You can use this as a check list.

#1: Not externalizing configuration values in config file(s) (E.g: .properties, .xml, or .yaml). For example, not making the number of threads used in a batch job configurable via a config file. You may have a batch job that worked well in DEV environment, but when deployed to PROD it takes a longer time to complete due to larger datasets. If the number of threads are configurable, the number of threads can be tweaked. This applies to all other configurable values like web service URLs, host names, port numbers, log levels, timeout values, etc. A Config Server is a MicroServices Architecture (aka MSA) feature where all configurable parameters of Microservices are written to & maintained.

#2: Not testing the application with the right volume of data. For example, testing your application with 1 to 3 accounts instead of 1000 to 2000 accounts, which is the typical scenario in the production environment.… Read more ...

30+ Java Code Review Checklist Items

This Java code review checklist is not only useful during code reviews, but also to answer an important Java job interview question,

Q. How would you go about evaluating code quality of others’ work?

You also learn a lot from peer code reviews. What has been written well? Why was it done this way? Could this have been written differently?, etc. This is one of the benefits of volunteering to review code via open-source project contribution.


Checklist Description/example
Functionality is implemented in a simple, maintainable, and reusable manner. Keep in mind some of the design principles like  SOLID design principles, Don’t Repeat Yourself (DRY), and Keep It Simple ans Stupid (KISS).

Also, think about the OO concepts — A PIE.   Abstraction, Polymorphism, Inheritance, and Encapsulation. These principles and concepts are all about accomplishing “Low coupling” and “High cohesion“.

Apply functional programming (FP) paradigm where it makes more sense.

Clean code

Checklist Description/example
Use of descriptive and meaningful variable, method and class names as opposed to relying too much on comments. E.g. calculateGst(BigDecimal amount), BalanceLoader.java, etc.

Bad: List list;

Good: List<String> users;

Class and functions should be small and focus on doing one thing. No duplication of code. E.g. CustomerDao.java for data access logic only, Customer.java for domain object, CustomerService.java for business logic, and CustomerValidator.java for validating input fields, etc.
Read more ...

01: 14 Unix must-know interview questions & answers

Q1 How do you remove the Control-M characters from a file?
A1 Control-M is a carriage return on keyboard. The ^M is the keyboard equivalent to \r. In a file originated from DOS/Windows the \r\n is used for an end of line carriage return, whereas in Unix it is \n for a new line.

So, if created a file in DOS/Windows and copied it to a Unix machine, you need to convert the carriage returns from \r\n to \n. You need to remove \r.

Using the sed command that replaces Control-M with nothing

Note: The ^M is typed on the command line with ctrl+v and ctrl+M

You can also use a vi editor and type :%s/^M//g to remove the control-M characters.

Q2 How will you search for a property named “inbox” within a number of .properties files including all sub folders?
A2 Using the find and grep commands. Yoo can use xargs command or -exec attribute. xargs is faster.

Read more ...

01: Q01 – Q07 Spring framework core interview Q&As

Spring framework interview questions are very common for the Java programmer jobs. This covers Spring framework beginner interview questions on the Spring core and more advanced Spring framework interview questions at Java microservices interview questions.

Q1. What do you understand by the terms Dependency Inversion Principle (DIP), Dependency Injection (DI) and Inversion of Control (IoC) container?
A1. The differences are very subtle and can be hard to understand. Hence, explained via code samples.

1) Dependency Inversion Principle (DIP): is one of the 5 OO design principles abbreviated as “SOLID”, and “D” stands for DIP meaning that we should always only rely on interfaces and not on their implementations. The idea of DIP is that higher layers of your application should not directly depend on lower layers. DIP is the principle that guides us towards DI pattern. You will see in the example below that the higher layer module “MyServiceImpl” depends on the lower layer module interface “Processor” and NOT on the implementations “XmlProcessor” & “JsonProcessor”. This is commented on the code shown in Q3 for “MyServiceImpl” as “// code to interface” for the understanding.

2) Dependency Injection (DI): is a design pattern where instead of having your objects create a dependency or asking a factory object to make one for you, you pass the needed dependencies into the constructor (i.e.… Read more ...


500+ Enterprise & Core Java programmer & architect Q&As

Java & Big Data Tutorials