Java questions on OOP, threads, collections, exceptions and the JVM. Hiring? See hire Java developers or the senior Java developer salary guide.
Frequently asked questions
What are the main principles of object-oriented programming in Java?
Encapsulation, inheritance, polymorphism and abstraction. Together they help you organise code into reusable, maintainable components.
What is the difference between Thread and Runnable in Java?
Thread is a class; Runnable is an interface. Implementing Runnable is usually preferred because it lets you share resources between threads and still extend another class.
What is the difference between ArrayList and LinkedList?
ArrayList is backed by a dynamic array, so random access is fast. LinkedList is a doubly linked list, which is better when you insert and delete often.
What is the difference between checked and unchecked exceptions?
Checked exceptions, such as IOException, must be declared or handled. Unchecked exceptions, such as NullPointerException, happen at runtime and do not have to be declared.
What is the Java Memory Model and how does it relate to concurrency?
It defines how threads interact through memory, including the rules for visibility and atomicity that make multithreaded code behave predictably.
What is polymorphism in Java?
The ability of an object to take many forms. Java has compile-time polymorphism (method overloading) and runtime polymorphism (method overriding).
Explain the purpose of the final keyword.
On a variable it makes a constant, on a method it prevents overriding, and on a class it prevents extension.
What are abstract classes and interfaces, and how do they compare?
Abstract classes can have concrete methods and state. Before Java 8, interfaces could only have abstract methods; from Java 8 they can also have default and static methods. A class can implement many interfaces but extend only one class.
What is the diamond problem in Java?
It arises with multiple inheritance of classes. Java avoids it by not allowing a class to extend more than one class. It can still occur with default methods in interfaces, and you resolve it by overriding the method explicitly.
What is the difference between synchronized and Lock?
synchronized is a language keyword. Lock is an interface, implemented by classes such as ReentrantLock, that adds tryLock, interruptible locking and fairness options.
Keep reading
Same skill, other angles
- Hire contract Hibernate developers for production Java data layersHire developers
- Hire contract Java developers for Spring Boot and microservicesHire developers
- Java developer salary in IndiaSalaries & rates
- Senior Java backend developer (remote)Contract jobs
- How a fintech firm hired 15 Java contractors in 48 hoursCase studies

