UPDATED BY
Rose Velazquez | Sep 12, 2022

Interviewing for a software development position can be intimidating, even when development teams at the company use a well-known programming language that you’re also familiar with, like Java. 

It may seem like recruiters can ask any type of question — so should developers be expected to know the programming language inside and out? And what level of detail should they aim for when they answer?

Top 6 Java Interview Questions for Junior Developers

  1. Given an integer, return true if the integer is a palindrome.
  2. Given a string, return the length of the string using recursion. 
  3. Write a program to sort an array of integers.
  4. Scaffold out the classes and methods for a car rental application.
  5. Using that model, return a list of all cars that cost less than $100.
  6. Using that model, return a list of only medium-sized cars. 

Actually, candidates applying to junior and senior developer positions are going to see very different types of questions, said Gregory Oladipo, a Galvanize coding bootcamp instructor. Employers who want to hire a junior Java developer would ask basic coding questions that stick close to the Java programming language, while senior developers would be expected to have more real-world experience and well-rounded knowledge.

Top 6 Java Interview Questions for Senior Developers

  1. What’s the difference between using HashMap and HashTable?
  2. What’s the relationship between polymorphism and inheritance?
  3. How does garbage collection work in Java?
  4. Scaffold out the architecture you would need to build out a chat app. 
  5. What type of database, if any, would you use for it?
  6. What challenges would that architecture face as you scale up?

To help you prepare, here are examples of questions recruiters may ask during a Java interview.

 

Introductory Questions for Java Developers

For both junior and senior developers, successful interviews are ultimately more about seeing how candidates interact with hiring managers and work through problems than about testing their ability to memorize algorithms or Java syntax.

Here are three introductory questions Java developers might be asked as an interviewer gets to know them and begins to feel out how they might fit into a position and workplace culture.

 

1. What Drew You to a Career in Java Development?

This is a chance to demonstrate high-level understanding of Java by talking about some of the key features that made it attractive. Candidates should expand on the kinds of projects they’re looking to work on and how Java makes that kind of programming and development possible. This question also allows applicants to make reference to the direction they’re looking to take their career in as a java developer — a point that should connect to the position.

 

2. What Are Your Strengths and Weaknesses as a Java Developer?

A candidate should talk about themself as a developer and as a person, emphasizing technical skills, but also providing insight on what makes them tick as an employee. Are you someone with strong organizational skills? Do you thrive in a collaborative environment? Do you tackle problems with a solutions-based approach? Candidates should highlight those qualities and elaborate on how they can strengthen their work as a Java developer. They should also acknowledge the areas of software development they find challenging or skills that still need sharpening. This is a chance to discuss how a particular job opportunity can further growth in those areas.

Further ReadingLooking for a Software Developer Job? Try the Local Grocery Store.

 

3. Why Are You Interested in a Job With This Organization?

When formulating an answer to this question, applicants should consider their professional expectations, anticipated career path and hard and soft skills. This is when candidates should demonstrate what they hope to gain from their employment as well as what they bring to the table. They can also begin to indicate how their skillset might apply to the duties and responsibilities that would be asked of them within the team they’re applying to join.

 

Career Experience Questions for Java Developers

Stefanie Stewart, talent acquisition manager at SaaS company Kareo, said candidates aren’t graded on how they answer any single question. Instead, hiring managers consider all their interactions while candidates work through problems.

“It’s one of those things that’s evaluated through the process,” Stewart told Built In in January 2022.

Here are three example questions focused on past Java development experience.

 

1. Talk About Your Portfolio and Other Relevant Experience as a Java Developer.

This is a candidate’s moment to shine by featuring some of the projects they’re most proud of and explaining how they completed them and what made them so successful. Applicants should consider choosing a single project to speak on more in depth, detailing their role, the technical know-how employed, challenges they overcame and any lessons learned.

 

2. Why Do You Think You’re the Right Fit for This Position as a Java developer?

Here a candidate should demonstrate they’ve done their homework in terms of reading the job description closely and learning some basic information about the company — its values, mission and products or services. Candidates should showcase their education and professional experience as a Java developer and discuss how those attributes have prepared them for this specific role as well, as how this role fits into their overall career path.

 

3. Discuss a Particularly Challenging Problem You Faced in Your Career and How You Handled It.

Developers should take their time answering this one, thinking about both the technical and non-technical sides of the challenges they’ve faced in their Java development experience. Answering this question well involves applicants showing awareness of how stressors affect them and articulating the steps they take and support they seek to overcome challenges. It can also provide a recruiter or hiring manager with insight into how an applicant might perform under pressure within the company’s work environment.

 

Soft Skills Questions for Java Developers

Answering interview questions is about showcasing the skills you have already built up as a software developer

They create a space for job candidates to talk about both the technical and interpersonal side of their skillset. Developers should be able to discuss individual proficiencies as well as go over examples of how they’ve practically applied them.

Here are three examples of questions java developers might be asked about their soft skills.

 

1. How Would You Explain a Complex Problem or Concept to Someone Who Doesn’t Have the Same Technical Background as You?

This is an opportunity for a developer to showcase their technical knowledge as well as communication and collaboration skills. Applicants should draw on specific examples of topics they might realistically have to talk about with a coworker and walk through simplified explanations that cut down on technical jargon. Those who fall into the senior developer category should keep in mind this question might be testing their ability to work with, teach or mentor less-seasoned developers.

 

2. How Do You Prioritize Tasks Within a Project?

This question puts an applicant’s organizational and prioritization skills under the microscope. While they may have the coding skills and experience needed to complete given assignments, a hiring manager may be looking to see how they balance responsibilities with the pressure of deadlines and time constraints. Developers should be able to illustrate how they’ve dealt with competing priorities.

 

3. Can You Think of a Problem You Faced That You Didn't Know How to Solve? How Did You Overcome This?

Yes, this is the time to highlight problem-solving abilities, but it also lets developers call on a number of other skills, like creativity, teamwork and personal accountability. Were you willing to ask for help? Maybe this is a chance to talk about the ability to build relationships and collaborate with others. Were you able to do research to seek out the answer yourself? Perhaps this is a good time to highlight curiosity and a go-getter attitude.

For a junior developer who may be making a significant jump to the next level in their career, this question allows them to spotlight their desire to grow and learn from the people and resources around them. And even for a senior developer, this can be a time to show they’re still enthusiastic about professional growth.

 

Java Coding Questions for Junior Developers

Junior developers are often asked classic coding interview questions to gauge their comfort level with basic programming concepts. But Oladipo said he doesn’t get carried away with super difficult questions when interviewing junior developers.

“I would probably keep it very language-focused because maybe that’s their only language if they’re interviewing for a Java position,” he said.

Oladipo said he likes to ask questions that test candidates’ understanding of concepts, like loops and recursion, and would also ask them to do some light architecting, like setting up a simple class — tasks that should be well within candidates’ comfort zones.

Here are three examples of coding interview questions for junior Java developers.

 

1. Given an integer, return true if the integer is a palindrome.

This question is used to test candidates’ understanding of loops — regardless of whether they prefer for loops, while loops or do while loops. It’s a good opportunity to show off logical thinking skills and a basic understanding of how to structure functions in Java. Junior developers don’t have to worry too much about the space and time efficiencies of the problem at first. Instead, talk through the problem with the hiring manager, focusing on edge cases and what types of integers would not count as palindromes. Then, focus on the logic puzzle at the center of the problem — how to split the integer in half and check for symmetry.

 

2. Given a string, return the length of the string using recursion.

This is a very basic recursion question, but still trickier than a loop question. Candidates have to first understand how recursion works, and then be able to translate that knowledge into code. Hiring managers are checking to see if candidates can structure their function correctly. Don’t get thrown off by recursion’s reputation as a confusing concept. Remember, the trick with recursion is figuring out the return condition that stops the function from further recursion. Start from there, and then figure out the logic the function uses to call itself.

 

3. Write a program to sort an array of integers.

This question tests candidates on their ability to manipulate arrays and code a basic sorting algorithm. The question also offers some flexibility to hiring managers, who can follow it up by asking about the solution’s performance and scalability. Java has built-in sorting functions, so be sure to ask the hiring manager whether you can use them to answer this question. If you do use the built-in functions, they may follow up by asking about the drawbacks and limitations of that function.

More on Interviewing34 Most Common Behavioral Interview Questions (With Sample Answers)

 

Design Questions for Junior Java Developers

Junior developers aren’t expected to know nearly as much about design and architecture as senior developers, but Oladipo considers it important to still ask them to translate a basic real-life problem into a software design. He said a common scenario to imitate would be a rental car business. Oladipo would ask candidates to draw out on a whiteboard the classes and methods needed to run a rental car company.

“Regardless of [experience] level, having them go through a UML diagram is always helpful, because then you can see how they’re thinking.”

“Regardless of [experience] level, having them go through a UML diagram is always helpful, because then you can see how they’re thinking,” he said. The diagrams candidates draw reflect how they think about architecting applications.

Here are three examples of design questions for junior Java developers.

 

1. Scaffold out the classes and methods for a car rental application.

Oladipo said these types of questions are more about seeing how candidates reason through a real-life problem than checking for correct syntax. Candidates are asked to use whiteboards, and he tries not to probe into the nitty-gritty details, preferring to hear developers’ thought processes. Developers should try to vocalize their thinking as much as possible — this will help hiring managers evaluate candidates’ design skills, and it will also help candidates figure out the scope of the application they’re asked to sketch out by getting feedback from hiring managers.

 

2. Using that model, return a list of all cars that cost less than $100. 

This question asks candidates to use their own model as a basis to do more programming. Candidates have to quickly develop a good understanding of their own design and be comfortable with how classes work in order to return the information they want. Developers should think about what logic should be contained within the class and what logic can take place in external functions, and the tradeoffs associated with those design decisions.

 

3. Using that model, return a list of only medium-sized cars.

This and the previous question both get candidates to think more deeply about their classes and about how their data is stored. It’s not considered a bad sign if a candidate realizes there are flaws in their original design while answering these questions. Developers can talk about any changes they would make to the initial design as well.

Find out who's hiring.
See all Developer + Engineer jobs at top tech companies & startups
View 9856 Jobs

 

Java Technical Questions for Senior Developers

Technical questions for senior developers can look quite different from the coding questions for junior developers. Oladipo likes to ask questions about data structures to figure out whether senior developer candidates are familiar with different data structures’ strengths and weaknesses. Candidates should be familiar with deciding which data structures to use based on the constraints in each situation.

“You’re expecting a senior developer to understand not only space complexity but time complexity — so that they can mentor the novice developers on your team,” Oladipo said.

It’s a good way to check whether senior developers have a good understanding of Java on a deeper level — not just that they know how to write code, but that they are always thinking of better ways to structure code more efficiently.

“You’re expecting a senior developer to understand not only space complexity but time complexity — so that they can mentor the novice developers on your team.”

According to Stewart, it’s more common to ask about the decisions senior candidates make during the process of answering technical questions.

“Why did you choose that?” Stewart said, by way of example. “Or, ‘What was the reason you decided to move away from something?’ It’s to understand their ability to compare and make business decisions.”

Here are three examples of coding interview questions for senior Java developers.

 

1. What’s the difference between using HashMap and HashTable?

Different data structures operate differently under the hood, and it’s important senior developers understand the benefits and drawbacks of different implementations and types of data structures. Candidates should discuss the different properties between these data structures, and what scenarios would work best for each one. For example, candidates can talk about the differences in how each type of data structure treats null keys and values.

 

2. What’s the relationship between polymorphism and inheritance?

This type of question gauges whether candidates understand different ways to structure classes within larger applications. Because the two concepts are related — polymorphism falls under the behavior of inheritance — Oladipo said he may stick to only asking about how one concept works, then ask the candidate to compare it to the other. With this type of question, he said, “I’m looking at their small-scale architectural skills.” Candidates can start by defining the concept of inheritance, and then explain how polymorphism extends that behavior.

 

3. How does garbage collection work in Java?

This type of question isn’t asking about the algorithm behind garbage collection, which is complex. Instead, candidates may be asked to talk about the advantages and disadvantages of having a garbage collection service built into the language.

“This is not just a cursory, top-level understanding of the language,” Oladipo said. “It’s more, ‘OK, I understand how the language and the way that it is interpreted — therefore I can use that to create more robust applications.’”

More on Software Development17 Must-Read Books for Software Developers

 

Design Questions for Senior Java Developers

Design problems for junior and senior-level developers may not look that different initially, but it’s the follow-up questions that reveal the distinction in experience levels. Stewart said design questions for senior candidates are all about hearing their reasoning.

“Being able to speak to the process of how decisions were made and talking through trade-offs — that’s what sets the senior apart from the junior in a lot of ways,” Stewart said. “Being able to speak to the reason they’re using specific technologies, that just shows the experience.”

“Being able to speak to the process of how decisions were made and talking through trade-offs — that’s what sets the senior apart from the junior in a lot of ways.”

So while they’ll encounter the same types of design scenarios, senior developers should be prepared to talk through a lot of the implications of their design — how it scales, how performant it is, and what tools and methods to use to ensure that the code runs optimally for different types of use cases.

Here are three examples of design questions for senior Java developers.

 

1. Scaffold out the architecture you would need to build out a chat app.

This question is similar to the one given to the junior candidate. In this case, instead of mapping out a car rental company, the task is to whiteboard the architecture for a chat app service. Candidates aren’t expected to go into granular detail on all aspects of the app. Rather, focus on including the most important features like whether there needs to be data storage, how to send notifications and how to manage users when they are offline and online. Be sure to talk through your design process so the hiring manager can answer questions and give feedback along the way.

 

2. What type of database, if any, would you use for it?

For this question, candidates would have to think through how a chat app works and the types of data such an application may need to store. The form of the data being stored, the way it is collected and how often it is accessed all have to do with the type of database to use. For instance, chat apps may need to store chat histories, user profiles, images or videos — these different formats can all affect the type of database that works best.

 

3. What challenges would that architecture face as you scale up?

Candidates should be able to talk about what happens to the design as more users begin using the chat app platform. They should be able to reason through the pain points that will emerge and where the software should be expected to see strain. Hiring managers may ask about what happens when the number of concurrent users on the platform exceeds a thousand or a million. For example, are there better ways the code should be structured to accommodate for that?

Great Companies Need Great People. That's Where We Come In.

Recruit With Us