5 Simple Java Screening Questions For Recruiters

5 Simple Java Screening Questions For Recruiters
Post Author: Aaron Decker | Image by Clker-Free-Vector-Images from Pixabay
Date published: March 01, 2020

Java is maybe the most common backend language used in software engineering jobs. Amazon, Google, Netflix, Apple, and Twitter are all major tech companies that extensively use Java.

In this post I'll go over a couple of basic technical "weed out" questions you can ask Java developers.

The problem with most Java programming questions

Java is a language that strictly enforces and requires the programmer to understand and use OOP (Object Oriented Programming) principals.

Unfortunately many articles you will read on the internet will suggest asking these academic questions about Java.

Asking a candidate to name the 5 OOP concepts featured in Java (Object-Orientation, Inheritance, Encapsulation, Polymorphism, Abstraction) is pointless. It gives no indication that the candidate can do anything other than memorize words and definitions.

People love to ask these vocabulary questions in interviews and they suck. I think these are bullshit interview questions, and they don't shed any light on whether or not somebody has any skill or experience as a programmer.

If somebody asks me this in an interview it would probably give me pause because I think it has little evaluative quality and means the other people they hired before me may not be good engineers. Yes candidates are interviewing the company as well.

These questions below are less academic and more about programming and working in Java. They are also all pretty easy so if somebody messes these up it should be an actual red flag.

1. What are the types of loops in Java?

A fairly easy question. I'll list them out here. I would ask a candidate to name 3 or so, maybe not all of them...

  • for loop. The basic for loop with an incrementing variable.
  • for each loop. A loop you can iterate over collections with. It uses the same for keyword as the other for loop.
  • while loop
  • do while loop
  • Java 8+: has forEach function on the collection interface, which is a more functional style of programming but it does not use the for keyword.

2. What is the difference between a "break" and "continue" statement?

Another question having to do with loops. The answer is simple and it should be difficult for a candidate to answer differently in a way that is correct. What I mean by that is that if they say anything else its probably wrong.

  • Break: this keyword immediately stops the loop permanently.
  • Continue: this keyword stops (or skips) the current loop iteration, and causes the loop to go to next one.

A "loop" is basically just a block of code that executes over and over based on some parameters. Break and continue just help you to control this.

3. What happens when you use the "Static" keyword on a variable?

The "static" keyword is a way to declare variables (declare means define, or to tell the program you want to make a variable). Variables are basic building block of programming languages used to store information a program will access.

Static means that for every copy you make of a class, it will always point back to the same value.

For example, let's say you create 5 copies of a class called "Breakfast" and it had a static variable called "bacon". That means the value of the bacon variable would the same for every Breakfast class.

Sorry if that example made you hungry, I happened to have bacon with breakfast this morning!

4. What does the "final" keyword do when you use it to declare a variable in Java?

Another questions about a keyword you can use when declaring variables.

Final means that a variable once assigned, can never be reassigned. This means it can be considered a "constant" or a thing that be relied on to always have the same value once it is set. You can't change the value of the variable once it is set.

Note that you can use final in other places but this question is just about declaring variables.

5. A trick question: How are pointers used in Java?

Answer: They aren't. Java has a "garbage collector" which automatically manages memory for the programmer and there is no such thing as a pointer that a programmer can use in Java.

Pointers are a concept encountered in languages such as C and C++ where programmers have access to memory locations directly.

Bonus: Your Java Application Server Has Crashed In Production - What do you do?

This is a real world question, you want to understand how a candidate solves problems. They might answer with any of these things:

  1. Check the server logs and look for error messages.
  2. Check to see if the server ran out of memory.
  3. Check to see if disk space is full (often people log to disk and the logs fill the disk to capacity - try to write a log with the full disk and the server crashes!)
  4. Check your monitoring or reporting system to see if any unusual metrics were reported.
  5. Check to see if there are any networking or connectivity issues.

I would expect somebody to say #2 especially, since Java applications are notorious for running out of memory.

Summary

If you want to screen candidates for Java skill before you send them to a client, avoid the academic ones about OOP concepts. They don't indicate much of anything except that the candidate studied a list of crappy common Java interview questions on the internet.

Instead, its pretty easy to ask basic language concepts going over things like loops and keywords.


Want updates?

Want new posts about tech topics emailed to you? Sign up to the list below 👇

Also, if you are interested in learning technical topics through a video course specifically created for recruiters, don't forget to check out the courses I offer.

The main course "How to Speak Software Engineering Jargon for Recruiters" is specifically designed to help tech recruiters get up to speed fast on technical topics.


Written By Aaron Decker

I'm a full stack developer specializing in Node.js and React. I have worked as a Tech Lead and hired teams, and as a Senior Software Engineer at multiple fortune 500 companies building large products. I also did a brief stint teaching programming courses as an Adjunct Instructor at a local community college.