Interview preparation tips for Java developers

Do you program in Java? Are you preparing for an interview? Then you should read this.

photo of Sean Patrick Floyd
Sean Patrick Floyd

Search Engineer, Retail Core / Technology

Posted on Jun 22, 2016

Technical interviews are part and parcel of the job hunting journey for developers. They’re usually the only chance developers have to convince companies they’re the right fit for the role. Skills such as problem solving and critical thinking are all high on the wish list for prospective employers, but what about the nitty gritty of your preferred programming language?

Java programming roles need to cover a lot of ground when it comes to knowledge and processes. We’ve put together a list of essential points that developers should be familiar with when applying for a Java development position.

  • Know the contracts of the equals / hashCode / compareTo methods, including different ways to implement them, plus the reasoning why to go with them. You should have at least a superficial understanding of how these methods are used in common data structures. It’s also best to know contracts and implementation details of the major collection types: Understand when a Set is more appropriate than a List, or in what situations a LinkedList is preferable to an ArrayList. Be aware of the time and space complexities of common usage patterns.
  • Embrace immutability and the reasoning behind using it. Work at understanding the difference between unmodifiable views and immutable copies. How can you make a class immutable if it contains potentially mutable data like collections, dates, and arrays?
  • Think about correctness. Embrace techniques like Design by Contract, or Defensive Programming, on top of understanding that null is evil and what the alternatives are.
  • Understand concurrency, both on a low level (threads, synchronized blocks) and on a high level (ExecutorServices, ConcurrentMaps, BlockingQueues, ReadWriteLocks). Think about when lazy evaluation is preferable to eager copies.
  • Think about testing and know how to write testable code. You’ll be expected to know how to write readable tests, using the appropriate level of abstraction ( Hamcrest, JsonAssert, etc.), and which corner cases to cover in your tests (@Parameterized runner, property testing). Understand what to mock and how, as well as knowing about the testing pyramid and common approaches in testing (TDD, BDD etc.).
  • Find the right level of abstraction. Object-oriented design is about finding the sweet spot somewhere between “stringly typed” and “Baklava code”. You’ll want to use functional idioms, but don’t overuse them: Java is not a functional language. Know your design patterns, but don’t over-engineer. Embrace the Inversion of Control, whether you use a framework like Spring or manual techniques.
  • Something very important to know about is Microservices. There are many frameworks out there that will help you build, deploy, monitor and interact with Microservices. Master at least one REST framework (Spring Boot, Play, DropWizard etc.). Make sure you are aware of concepts like scaling and resilience, event-driven architectures, and asynchronous logging, as well as having a conceptual understanding of REST. Having said that, know at least the basics about containers (e.g. Docker), clouds (e.g. AWS), build systems, and continuous delivery.
  • Let's talk about data. You’ll need to know both traditional SQL databases (we love Postgres) and different types of NoSQL datastores (Redis, Cassandra, DynamoDB etc.). Work to understand Message Queues (Kafka, Kinesis) and Big Data engines (Spark, Storm, Flink).

We also recommend that Java developers read the following books: Effective Java, Clean Code, and Java Concurrency in Practice. It’s also good practice to hone your craft on HackerRank and/or on StackOverflow.

While you won’t reasonably be able to master all of the above, you should try to understand most of them on a superficial level and deep-dive into several of these points. We’re just one of many companies who are looking for Java developers right now. Happy job hunting!