Typical java interview questions sorted by experience
Junior * Name some of the characteristics of OO programming languages * What are the access modifiers you know? What does each one do? * What is the difference between overriding and overloading a method in Java? * What’s the difference between an Interface and an abstract class? * Can an Interface extend another Interface? * What does the static word mean in Java? * Can a static method be overridden in Java? * What is Polymorphism? What about Inheritance? * Can a constructor be inherited? * Do objects get passed by reference or value in Java? Elaborate on that. * What’s the difference between using == and .equals on a string? * What is the hashCode() and equals() used for? * What does the interface Serializable do? What about Parcelable in Android? * Why are Array and ArrayList different? When would you use each? * What’s the difference between an Integer and int? * What is a ThreadPool? Is it better than using several “simple” threads? * What the difference between local, instance and class variables?
Mid * What is reflection? * What is dependency injection? Can you name a few libraries? (Have you used any?) * What are strong, soft and weak references in Java? * What does the keyword synchronized mean? * Can you have “memory leaks” on Java? * Do you need to set references to null on Java/Android? * What does it means to say that a String is immutable? * What are transient and volatile modifiers? * What is the finalize() method? * How does the try{} finally{} works? * What is the difference between instantiation and initialisation of an object? * When is a static block run? * Why are Generics are used in Java? * Can you mention the design patterns you know? Which of those do you normally use? * Can you mention some types of testing you know?
Senior * How does Integer.parseInt() works? * Do you know what is the “double check locking” problem? * Do you know the difference between StringBuffer and StringBuilder? * How is a StringBuilder implemented to avoid the immutable string allocation problem? * What does Class.forName method do? * What is Autoboxing and Unboxing? * What’s the difference between an Enumeration and an Iterator? * What is the difference between fail-fast and fail safe in Java? * What is PermGen in Java? * What is a Java priority queue? * *s performance influenced by using the same number in different types: Int, Double and Float? * What is the Java Heap? * What is daemon thread? * Can a dead thread be restarted?