Java Interview Questions
Java Interview Questions
What are the 4 pillars of OOPS? What is an abstract class? Does the Abstract class have a constructor? What is an Interface? Difference between abstract class and interface. What
to choose – interface or abstract class Why default methods were introduced? Why were static methods introduced? Why does Java not allow multiple inheritance? What are these
rules for? Can we override final methods? Can constructors and private methods be overridden? What is the final keyword and where can it be used? What is exception and
exception handling? Difference between error and exception What are the different types of exceptions? How is exception handling done in java? Can we write a try block without a
catch block? How to handle multiple exceptions together? When finally block will not get executed. Difference between throw and throws keyword. And discuss exception handling
w.r.t. method overriding. Programs related to Exception handling and return keywords. How to make your own custom exception class? How to make custom checked / unchecked
exceptions? What happens when you throw an exception from the finally block? Explain try-with-resources.
Why is String Immutable? What does the equals() method of String class do? Explain StringBuffer and StringBuilder? Explain the output of the below program related to equals()
method of StringBuilder. When to use String/StringBuffer/StringBuilder? Explain equals and hashcode contracts. What is Marker Interface? Can you write your own custom Marker
interface? What is Comparable and Comparator? How to compare a list of Employees based on name and age such that if the name of the employee is the same then sorting should
be based on age. Difference between Comparable and Comparator? Different methods of Object class. What type of arguments are allowed in System.out.println() Method? Explain
System.out.println() statement. Explain Auto-boxing and Unboxing. Can you pass primitive long values in the switch statement? Explain static keywords in Java. What is an Inner
Class in Java, how can it be instantiated and what are the types of Inner Classes? What is Constructor Chaining in java? What is an init block? What is called first, constructor or
init block? What is Variable shadowing and Variable hiding in Java? What is a constant and how do we create constants in Java? Explain enum. What is Cloneable? What is Shallow
Copy and Deep Copy? What is Serialization and Deserialization? What is SerialVersionUID? Serialization scenarios with Inheritance. Stopping Serialization and Deserialization.
What is an Externalizable Interface? Difference between Serializable and Externalizable How to make a class Immutable? Explain Class loaders in Java. What is the Singleton
Design Pattern and how can it be implemented? What are the different ways in which a Singleton Design pattern can break and how to prevent that from happening? What are the
different design patterns you have used in your projects?
Explain Volatile keywords in java. What is Garbage Collection in Java, how it works and what are the different types of Garbage Collectors? Explain Generics in Java. What is
Multithreading? How to create a thread in Java? Which way of creating threads is better: Thread class or Runnable interface. What will happen if I directly call the run() method
and not the start() method to execute a thread? Once a thread has been started can it be started again? Why wait, notify and notifyAll methods are defined in the Object class instead
of Thread class? Why wait(), notify(), notifyAll() methods must be called from the synchronized block difference between wait() and sleep() method, join() method, yield() method?
Tell something about synchronized keywords. What is static synchronization? What will be the output of the below program where one is the synchronized method calling another
synchronized method? Programs related to synchronized and static synchronized methods. What is Callable Interface? How to convert a Runnable to Callable. Difference between
Runnable and Callable. What is Executor Framework in Java, its different types and how to create these executors? Tell something about the awaitTermination() method in the
executor. Difference between shutdown() and shutdownNow() methods of executor. What is a Countdown latch in Java? What is CyclicBarrier? Atomic classes?
What is Collection Framework? What are Collections? What is ArrayList? What is the default size of ArrayList? Which data structure is used internally in an ArrayList? How does
the add() method work internally or How does the ArrayList grow at runtime? How to make an ArrayList as Immutable? What is LinkedList? When to use ArrayList / LinkedList?
What is HashMap? Explain the internal working of put() and get() methods of HashMap class and discuss HashMap collision equals and hashCode method scenarios in HashMap
when the key is a custom class. How to make a HashMap synchronized? What is Concurrenthashmap? What is HashSet class and how does it work internally? Explain Java’s
TreeMap. Explain Java’s TreeSet. Difference between fail-safe and fail-fast iterators. Difference between Iterator and ListIterator. Difference between Iterator.remove and
Collection.remove()?
What is the difference between a Monolith and Micro-service architecture? What is Dependency Injection in Spring? What are the different types of Dependency Injection?
Difference between Constructor and Setter injection? What is @Autowired annotation? What is the difference between BeanFactory and ApplicationContext? Explain the life-cycle
of a Spring Bean? What are the different scopes of a Bean? What is the Default scope of a bean? What happens when we inject a prototype scope bean in a singleton scope bean?
How to inject a prototype scope bean in a singleton scope bean? Explain Spring MVC flow. What is the difference between <context:annotation-config> and
<context:component-scan>? What is the difference between Spring and SpringBoot? What is auto-configuration in SpringBoot? What are SpringBoot starters? What is
@SpringBootApplication Annotation? Where does a Spring Boot application start from? How to remove certain classes from getting auto-configured in SpringBoot? How to
autowire a class which is in a package other than SpringBoot application class’s package or any of its sub-packages What is application.properties file in a SpringBoot application?
How to configure the port number of a SpringBoot application? \ Which jar builds our spring boot application automatically whenever we change some code just like a node.js
application? What default embedded server is given in spring boot web starter and how can we change the default embedded server to the one of our choice? Where should we put
our html and javascript files in a spring boot application? What are the different stereotype annotations? Difference between @Component, @Controller, @Service, @Repository
annotations? Difference between @Controller and @RestController annotation. What is @RequestMapping and @RequestParam annotation? How to define a Get or Post
endpoint? Which annotation is used for binding the incoming json request to the defined pojo class? What is @Qualifier annotation? What is @Transactional annotation? What is
@ControllerAdvice annotation? What is @Bean annotation? Difference between @Component and @Bean How to do profiling in a SpringBoot application? What is RestTemplate?
What is Spring Data JPA? What is the difference between JPARepository, CRUDRepository, PagingAndSortingRepository and which one you have used in your applications? What is
Spring AOP? Have you used Spring Security in your application? What do you know about the Spring Batch framework? Difference between SOAP and REST? What is Restful api?
What is a stateless object? What is the difference between Web Server and Application Server? What do you know about CommandLineRunner and ApplicationRunner? What do you
know about Eureka Naming Server? What do you know about Zuul? What do you know about Zipkin? What do you know about Hystrix? What is JPA? What is Hibernate? Difference
between JPA and Hibernate? What is @Entity? How to give a name to a table in JPA? What is @Id, @GeneratedValue? How to use a custom database sequence in Hibernate to
generate primary key values? How to give names to the columns of a JPA Entity How to define a @OneToMany relationship between entities? Why should annotations be imported
from JPA and not from Hibernate? What is the difference between get() and load() method of Hibernate Session? What is the difference between save(), saveOrUpdate() and persist()
method of Hibernate Session? What is Session and SessionFactory in Hibernate? What is First Level and Second Level Cache in Hibernate? What is the session.flush() method in
Hibernate?
How can we see the SQL query that gets generated by Hibernate? What is Hibernate Dialect and why do we need to configure it? What do you know about hibernate.hbm2ddl.auto
property in Hibernate? What is Maven? What is pom.xml? What is the local repo and central repo? Where do we define our local repo path? Where do we define proxies so that
maven can download jars from the internet in a corporate environment? Explain Maven build life-cycle? What do you know about SQL Joins? Difference between TRUNCATE &
DELETE statements? Difference between Function and Stored Procedure? What are DDL, DML statements? How to find the nth highest salary from the Employee table. Difference
between UNION and UNION ALL commands in SQL. Difference between Unique Key and Primary Key in SQL. What is the difference between Primary and Foreign keys in SQL?
What is the difference between clustered and non-clustered indexes? What is the difference between WHERE and HAVING clauses in SQL. How to change the gender column value
from Male to Female and Female to Male using a single Update statement.
Java Advanced Questions
What are Java Generics? Write a program to explain Generic Methods. Differentiate between List<?extends T> and List <?super T>. Explain the Type Parameters in Generics.
How to avoid casting when retrieving elements from a collection? Can you use more than one parameterized type in a declaration? Give an example. How can you declare a generic
method using a type say: T, which is not defined in the class? Can you instantiate an array of a generic type?
What is a thread? Explain the different stages of a thread. How to indicate a safe thread implementation? We know what a Deadlock is. Explain Livelock. Explain with examples,
how to create a thread. Explain wait(), yield() and sleep() methods in Java. There are three threads Thread1, Thread2 and Thread3? How do you ensure the sequence Thread1,
Thread2, Thread3 in Java? What are the two ways of creating Threads in Java? What happens if start() is called more than once on the same thread object? Can you create more
than one Thread object using the same Runnable object as the target? When does a thread object become a thread of execution? When is a thread considered alive? A new thread is
started. In which state it will enter? When does a thread enter into the dead state? You have a single-processor machine. How many threads can be made running at a time? Does
the order in which threads were started determine the order in which they'll run? Do threads take turns in any fair way? How can you guarantee that your threads will take turns
regardless of the underlying JVM? You invoked sleep() method on your thread to delay its exception for some time. Will it start running as soon as the sleep period is over? What is
thread priority and how can you define it? What is the default priority of a thread? What is the purpose of the join() method? You have a method that has some critical code that you
wish to protect from multiple threads’ simultaneous execution. What can you do to protect it? Does a sleeping thread release all its locks? How can you synchronize a block of code
i.e. not the whole method? What does the wait method do? Can the notify() method specify which waiting thread to notify? What is the difference between notify() and notifyAll()
methods? Is it necessary to call wait(), notify() and notifyAll() from within a synchronized context? What is the difference between wait and sleep methods? Can you override the
Thread start()method?
What is Servlet? Explain the life cycle of a Servlet. How to create a Servlet? Explain with code. What are Servlet Filters? How do they help Servlet Programming? Explain Session
tracking in Servlets. Differentiate between ServletContext and ServletConfig. How to unload a Servlet? Assume that you have deployed a Servlet on a web container. When does it
get loaded? Which web.xml tag is used to define the Servlet loading order? Can you instantiate a Servlet class by using a new keyword? A GET request is made to your Servlet and
doGet() method will be invoked. How will the parameter be received? A POST request is made to your Servlet and doPost() method will be invoked. How will the parameter be
received? In which scenario doGet() is to be used? In which scenario doPost() is to be used? When comparing doGet with doPost, which one is faster? What is the data limitation of
GET requests? Name the phases of Servlet life cycle. Can you call doPost manually from a doGet method? Why should I not override the service() method in my HttpServlet? Which
one is faster? forward() or sendRedirect()? sendRedirect() is a two phase process, which are those phases? Why is the original request context retained in forward()? You want to
redirect a request to another resource that is in some other domain. Will you use forward()? Where does Servlet run? Which protocols are supported by Java Servlet? How session
tracking is done by Servlet container? Define session mapping. Define Servlet context. I want to initialize Servlet using a constructor instead of init(). Will I have access to
ServletConfig to ServletContext? How do you get the current Servlet path i.e. its location on the file system? When does the init() method get called? How to make init() method
thread safe? How can you call a Servlet from another Servlet? Give an example to show how RequestDispatcher can be used to forward a request from one Servlet to another. What
is the difference between request.getParameter() and request.getAttribute() where request is an instance of? How can you access a client's directory structure from a Servlet? What
are Generic Servlets? What is the difference between Generic and HttpServlet Servlet? Is HttpServlet a concrete class? Since HttpServlet is an Abstract class, which methods must it
override? Who controls the life cycle of a Servlet? When a request is mapped to a Servlet, what does the container do? Which method is invoked by the container once it needs to
remove the Servlet? What is the purpose of the service method? You want to write a Servlet for Http protocol. Which class do you need to extend? Which exceptions are thrown by
the doXXX methods? Where can you define Servlet mapping? How can you define context init parameters in web.xml? How can you retrieve context init parameters in Servlet? How
can you set an error page in web.xml? Give an example of Servlet mapping in web.xml. Define ServletContext. Will all the Servlets in a web application share the same
ServletConfig? What methods are provided by ServletContextListener interface? When does ServletContextListener get notified? How to configure ServletContextListener in
web.xml? When deploying Servlet on a web container, what is the purpose of WEB-INF? What will happen if I want to use the Servlet 2.1 API instead of Servlet2.0 API? What is
lazy loading in servlet? How will you call a servlet along with the parameters in the URL?
What is Object Serialization? How is it done? Differentiate between Externalizable and Serializable interfaces? What is a serialVersionUID? How is it used? What is the next best
option if we do not go for Object Serialization? How can Java objects exist beyond the lifetime of the virtual machine? I wish to serialize a collection. Is it a must to have all its
members Serializable? How to exclude certain variables from an object's serialized state? Is it true to say that during object serialization class and instance variables that are not
marked as transient are also serialized? What will happen if I try to serialize an object of a class that implements the Serializable interface, but also includes a non-Serializable
object? Once de-serialization is done, what values will transient variables get? You are making a class Serializable by implementing a Serializable interface. Which methods are to
be implemented? What is the purpose of using serialVersionUID? serialVersionUID is a static field declared in a Serializable class. Is it also serialized? What happens if
serialVersionUID of a de-serialized object does not match to the one declared in the class definition? Consider that you have a Serializable class without serialVersionUID. How
will the compiler handle this? What methods are there in the Serializable interface? In which scenarios serialization should be used? What can be the cause of
NotSerializableException during object serialization? Which methods can be overridden to change default serialization behavior in order to control complex object serialization
processes? Which interface is to be implemented if we want to have complete control over your class's serialization process? Name the methods that are to be overridden when
Externalizable is implemented. Is it correct to say that when an object is deserialized, its constructor is called? I have a class called Student that is Serializable. It has an instance
variable of type String called 'name'. Since 'name' is not of primitive type, should we expect serialization failure? Are all primitive wrapper classes Serializable? Assume you have a
Serializable class where its super class does not implement a Serializable interface. The super class defines a no- argument constructor and a String argument constructor. Which
constructor of the super class will get called during deserialization?
What are Design Patterns and what types of Design Patterns does Java have? Explain the MVC Pattern. Explain Factory Method in Creational pattern. Explain the Proxy design
pattern. Explain Data Access Object or DAO. Explain the Intercepting Filter pattern. In which cases using Proxy pattern is preferred? What is the Facade pattern? What is the
other name for Adapter pattern? You wish to convert the existing interfaces to a new interface in order to achieve compatibility and reusability of the unrelated classes in your
legacy application. Which design pattern will you use? You want to add operations on a bunch of classes which have different interfaces. Which design pattern is to be applied?
Which design pattern is used to return one of several factories? What is the Singleton pattern? Give code examples.
Differentiate between Hashtable and Hashmap. Explain how Hashmap works in Java.Differentiate between Comparable and Comparator. Explain the output of the program.
Differentiate – Iterator, ListIterator and Enumerator. Both ArrayList and LinkedList implements get(int) method to fetch an object at specified position in list. Which one is faster?
Why can adding elements to ArrayList be slow? You want to add an element in the middle of a List. Which List implementation gives you better performance? LinkedList or
ArrayList? You want a List whose size will grow with time. You may also need to add elements in between existing elements but you will very seldom need random access. Which List
implementation you will prefer? Hashtable defines the following constructor: Hashtable(int initialCapacity, float loadFactor) What is initialCapacity and loadFactor here?What is
the Hashtable default load factor? What will be the initial capacity of Hashtable if it is created using: public Hashtable()? What is the difference between Hashtable and HashMap?
You use the following to get an Object from a HashMap. You have a HashMap and want to get a collection view of the mappings contained in this map? Which method will you
invoke? Is Map a Collection? What happens if you try to add a duplicate key in a Map? Which Map implementation will you use if you need to insert, delete, and locate elements in
a Map? In which case will you prefer TreeMap over HashMap? How can you tune HashMap and TreeMap? You want to create a single element set using the Collection class. How
will you do it in a single line of code? What happens if the hash value of the key in the map collides with an existing key in the Map? What are the two ways to traverse a collection?
Assume that you are traversing a Collection using an Iterator. Can you remove items from the Collection using its Iterator? If yes, how to? With respect to collections, what does
build operation mean?Which bulk operations are supported by the Collection interface? I have a Collection called 'c' and want to remove all the null elements from it. How should I
do it using the build operation? How can we convert a Collection to an Array? You have a Collection of String type and want to convey it into an Array of String type. How can this
be achieved? Name the three general-purpose Set implementations. Which java.util.Set implementation is the fastest one? Which java.util.Set implementation does not guarantee the
order of the elements? How java.util.TreeSet stores its elements? You have a Collection called 'c' that contains duplicates. How can you remove those using Set? You have a
Collection called 'c' that contains duplicates. How can you remove those using Set but want the order of elements? How can you get the cardinality of a Set? What happens if you try
to add an element that already exists in the Set? What happens if you try to remove an item from a Set that does not exist in the Set? Name the java.util.Set implementation that
orders the elements based on their insertion order. You have two sets namely set1 and set2. You want to do union operation in order to add set2 into set1. Which bulk operation will
you use? You have two sets namely set1 and set2: You want to remove all elements of set2 from set1. Which bulk operation will you use? Can a List contain duplicates? Apart from
inherited operations from Collection interface, what additional operations are provided by List? Name a few of the algorithms supported by my List. There are two forms of Queue
methods depending on the operation failure. Name them. What are bounded queues? Which Java package contains bounded queues and which one contains un-bounded queues?
You have an empty Queue and you try to remove an element using poll(). What will be the result? What will be the outcome of remove() operation conducted on an empty Queue?
You want to get the head element of a Queue. What methods can you use? What is the difference between element() and peek() methods of Queue? Name the Queue implementations
that allow insertion of null elements. Do Queue implementations generally define element-based versions of the equals and hashCode methods? In concurrent programming,
blocking queue methods are required. Does Queue interface provide that?: Name the general-purpose Map implementations.When comparing Map with Hashtable, which one of
these provides the functionality to remove entries in the midst of iteration? How do you differentiate between Vector and ArrayList? What is the difference between Collection and
Collections? Define the java.util.Vector class. What is an Iterator interface? Event handling is supported by which java.util classes and interfaces? What is the java.util.Map? What
is the highest-level event class of the event-delegation model? What is the difference between the size and capacity of a Vector?
How do you find the middle element in a linked list in one pass? Explain the BubbleSort Algorithm with code. Differentiate between Singly Linked List and Doubly Linked List.
Explain a Binary Search Tree. What are the classes included in the data structure of Java? How will you ‘AND’ the contents of the two bitset? How will you delete the elements from
invoking a bitset using the specified bitset? How will you clear the bits in the BitSet? What is the purpose of the functions “clone” and “equals”? Describe the “flip” function in the
bitset. How will you get the current state and hash code for the bit? How will you get the string equivalent and size for the invoking bitset object? How will you add an element to
the vector? How will you copy the component of a vector to an array? What is the purpose of ensureCapacity function in vector? Describe the remove and removeAll function. Give
an example of the ‘toArray’ function. What is the purpose of the get function in the hash table? How will you add the data into the hash table? How will you get the value of the key
in property class? How will you add the text to the list and display the property list? Describe the ‘pop’ and ‘peek’ function in the stack. How will you add the objects to the
collection? How will you insert the elements from one collection into another collection? How will you get the iterator for the list? In a collection of elements, after retrieving some
elements, how will we know there are still elements to retrieve? What is the purpose of nextElement()? What is the purpose of the ‘retain’ function in the collection interface? What
is the difference between ‘removeAll’ and ‘retainAll’ functions? Give an example for ‘set’ interface. How will you get the elements that are less than a particular element from the
collection? How will you get the elements that are greater than a particular element from the collection? How will you get the first and last element from the collection? What is the
purpose of the ‘subSet’ function in SortedSet Interface? What are the exceptions thrown by map interface methods? How will you replace the particular element in the
linkedlist?How will you get the index of the specified element’s last occurrence? How will you get the index of the specified element’s first occurrence? How will you get the first and
last element from the linkedlist? How will you add an element at the first position of the linked list? How will you add the element at the last position of the linked list? Compare
List<Employee> and List<? Extends Employee>. Can you modify a collection if a wild card is used as List<?>? What will happen if you do not declare an arraylist using generics
and try to get the values? How will you iterate over arraylist using advanced for loop? Can we overload static methods in java?
Describe the method that provides the interface for databases in Java. Describe how database connection is achieved using JDBC. Describe the way to load the jdbc driver. How
will you establish a JDBC connection? How will you execute the ‘SQL’ queries? What are the types of statements available in the statement object? How will you execute the
precompiled queries? How will you call a function in the database? What are the methods provided by the statement interface to interact with the database? What is the purpose of
ResultSet? What is ResultSetMetaData? Can you declare arraylist as below where generic data type will differ both left and right side? How would you know httpsession is removed
(when time outs)? How would you set and delete a cookie from the Servlet? How would you invalidate a session if the user closes the browser window? What is Server Side push and
use of it? What is the Client refresh/Client pull mechanism and how do we achieve it? How would you achieve/make Client Auto Refresh using servlets? What are the options
available for deleting session data? What will happen if you call the run() method directly rather than calling start()? What is the difference between synchronized static method and
synchronized non static method? Which thread will be started when JVM starts? How many locks will be acquired for an object? If a current running thread calls a new thread,
what is the priority of the newly created thread? What will happen if you synchronize variables?
Java Detailed Questions
What is a package? Why do you need to import packages? Why do you need to specify access modifiers? What is a static import? What is the difference between argument and
parameter?
Explain the process of Java code compilation and execution? What is bytecode? What is the difference between bytecode and source code? What is the machine code? What is the
difference between bytecode and machine code? What is JVM? Is it different or the same for different operating systems? What are the major components of JVM? What is the role
of the class loader in JVM? What is the role of the execution engine in JVM? What are machine instructions?
What are primitive data types? If a variable of primitive data type is not assigned, what does it contain? Why do we suffix L with long, F with Float and D with a double? What
happens when you assign a variable of a primitive data type to another variable of the same type? What are the reference data types? What happens when you assign a variable of
the reference data type to another variable of the same reference type? What are the differences between the primitive data types and the reference data types? What is the purpose
of variables and methods in a reference type? If a variable of reference data type is not assigned, what does it contain?
What is the meaning of naming convention? Why do we need a naming convention? What is the difference between Camel Case and Pascal Case? What is the difference between
Upper Camel Case and Lower Camel Case? Explain naming convention for Interface, Class, Method, Variable, Constant, Enum, and Acronyms?
What is the base class for all Java classes? What are the different methods of Object class available for overriding in the derived class? What happens if your class does not
override equals method from the Object class? The equals() method in Object class compares whether object references are the same and not the content. To compare content, you
need to override the equals() method. What is the purpose of the clone () method? Why should the overriding class define its implementation of the clone() method? What happens if
the overriding class does not override the clone() method?
What is the purpose of the access modifier? Is there any difference between the list of access modifiers available for a class and for its members? What is the scope of private,
protected, and public access modifiers? What happens when no access modifier is specified with the class? If a sub-class exists in a different package, can it still have visibility to
the protected members of the super-class? Why should the member access modifier in the derived class be less restrictive than the base? As per the concepts of Inheritance, you
should be able to use subclass objects with super-class reference. This will not be possible if a subclass member is decelerated with a more restrictive access modifier. What should
be the criteria to decide an access modifier for your class? You should use the most restrictive access modifier to ensure security and to prevent any misuse.
What are the static classes? Can any class be declared as a static class? What are the static methods? What are the static variables? Who owns the static class members? How is
that different for non-static classes? How should you access class members that are static? Can a static method have access to an instance member? Why?
Explain the final class? What are the benefits of declaring a class final? Explain the final method? What are the benefits of declaring a method final? Explain the final variable?
What are the benefits of declaring a variable final? When you declare a variable final, can you change the content of the object it's referencing? When you declare a variable final,
can you change it to reference another object? What is the blank final variable? How does declaring a variable as final help with optimization?
What is a static initialization block? What is the primary purpose of a static initialization block? What are the types of things you should do in a static block? Can you access
instance members from a static initialization block? Why? Does the static initialization block get called whenever an instance of the class is created? How many static blocks can be
defined in a class? When multiple static blocks are defined, what is the criterion about their order of execution? Can you throw an exception from the static initialization block?
What type?
How do you guarantee that a block of code is always executed? What are the things that you should do in the finally block? What are the things that you should do in a catch block?
Does the finally block always execute? What are the conditions when a finally block does not execute? Should you ever return from the finally block? Why? FINALIZE()?
What is the finalize method in Java? When does the finalize method get called? Who calls the finalize method? What are the things that can be done in the finalize method? Should
you explicitly call the finalize method to release resources? Why? What are some alternate mechanisms that can be used to release system resources? What happens if an unhandled
exception is thrown from the finalize method?
What is widening conversion? What is narrowing conversion? Is there any possibility of a loss of data in narrowing conversion?
Why do you need getters and setters when you can directly expose the class field? Explain a few benefits of using getters and setters?
What are varargs? What is the difference between varargs and object arrays? Can you call a method with zero arguments that expects a varargs as a parameter? Can you overload
a method that takes an int array, to take an int varargs? What are the different scenarios where you can use varargs?
What are default interface methods? What are the benefits of default interface methods? Can you add default interface methods to an interface that is not directly under your
control? Can you override the default interface methods to provide different implementations? What happens when a class inherits two interfaces and both define a default method
with the same signature? How defining a default method in an interface is different from defining the same method in an abstract class?
What is a static interface method? Where can you use static interface methods? Can you override static interface methods? What is the difference between static and default
interface methods? Can you add a static interface method to an interface which is not directly under your control? What happens if a class inherits two interfaces and both define a
static interface method with the same signature?
What are annotations? Where can you use annotations? Where can you apply annotations?
What are the Preferences? What are the types of information that can be stored with the Preferences? While using the Preference class, should you worry about the internal format
used by the operating system?
What is the difference between pass-by-value and pass-by-reference? How is the reference type argument passed in Java; by reference or by value? If a copy of the reference is
passed by value, how can the method get access to the object that reference is pointing to? If a copy of the reference is passed by value, can you change the value of reference?
What is Polymorphism? What are the different ways to achieve polymorphism? How is inheritance useful to achieve polymorphism? What are the benefits of polymorphism? How is
the polymorphism concept useful for unit testing?
What is Parametric Polymorphism? How is Generics used to achieve Parametric Polymorphism? How are the Type Wildcards used to achieve Parametric Polymorphism? Can you
achieve Parametric Polymorphism without Generics?
What is Subtype Polymorphism? What is Inclusion Polymorphism? What is the difference between Parametric Polymorphism and SubType Polymorphism? Can you achieve
SubType polymorphism using Generics?
What is method overriding? What is dynamic polymorphism? Why can't you override static methods defined in superclass or interface? Can you override a final method defined in
super-class? Can you override a public method in superclass and mark it protected? Why can't you override the constructor of super-class? Can an overridden method throw a
checked exception; when the method in superclass does not? Why? What are the benefits of method overriding?
What is the purpose of the @Override annotation? What happens if you define a method with the same signature as defined in the super-class and without using the @Override
annotation? What are the benefits of @Overrode annotation?
Explain method overloading? What is static polymorphism? What is the difference between static and dynamic polymorphism? Can you override a method such that all the
parameters are the same with the difference only in return type? What is operator overloading? What are the benefits of method overloading? What is the difference between
overriding and overloading?
What is abstraction? How abstraction is different from encapsulation? What are the benefits of abstraction? Can you achieve abstraction without encapsulation?
Explain inheritance? What is the purpose of inheritance? What should be the criteria to decide the inheritance relation between two classes? How inheritance plays an important
role in polymorphism? Can you inherit the final class? What happens if you don't use the super keyword to call an overridden member? Why can't you inherit static members
defined in the super-class? What are the challenges one can face if multiple inheritances are possible in Java?
Explain composition? What is the difference between inheritance and composition? What should be the criteria to decide the composition relation between two classes? Explain a
few problems with inheritance that can be avoided by using composition? When should you prefer composition over inheritance and vice versa?
What is Inversion of Control? What is Dependency Injection? What is the difference between the Inversion of Control and Dependency Injection? What are the different ways to
implement Dependency Injection? What are the different ways to identify dependency sources? Who has the responsibility to inject dependent objects? How is Dependency injection
useful for unit testing? How Dependency Injection can be used for modular software development?
Explain the Service Locator design pattern? What are the benefits of using a Service Locator design pattern? What is the difference between Service Locator and Dependency
Injection pattern? When would you prefer Service Locator over Dependency Injection and vice versa? How does Service Locator help in testing?
Explain the Diamond Problem in Java? Why does Java not provide multiple inheritance? Using default interface methods, a class can still inherit two interfaces with the same
signature method; would this not cause Diamond Problem? How can you solve it?
What is the concept of programming to interface? What are the benefits of programming to interface? How does programming to interface facilitate decoupling between software
components? How dependency injection and programming to the interface are interrelated? Can you achieve dependency injection without supporting programming to interface?
What are the benefits of modular software? How does programming to interface help with unit testing?
If an abstract class cannot be instantiated, then what could be a need to define a constructor for an Abstract class? A constructor can be used to perform the required field
initialization and also to enforce class constraints. Define Abstract class? What role does an Abstract class play in a class design? Define Interface? What role does Interface play
in class design? When would you prefer using Abstract class over Interface and vice-versa? Explain various differences between Abstract Class and Interface? What are marker
interfaces? How are marker interfaces used? Can you declare an interface method static? With the introduction of default interface methods; how is Abstract class still different
from an Interface?
What is Internationalization? What is localization? What is the difference between localization and internationalization? Can you achieve localization without building support for
Internationalization?
What is an immutable object? What are the rules for defining an immutable object? What are the advantages/disadvantages of an immutable object? How do you create an
immutable object? What are the different situations where you can use immutable objects? What is the difference between a final and an immutable object? What is the optimization
benefit of declaring a variable final? Can you list some of the problems with Immutability? It's harder to define constructors with loads of arguments. Since the enforcement of
immutability is left to the developer, even a single setter added accidentally can break it.
What is cloning? What is shallow cloning? Explain drawbacks with shallow cloning? What is deep cloning? What is CopyConstructor? When would you prefer deep cloning over
shallow cloning and vice versa?
What is NaN or Not a Number? What is Quiet NaN? What is Signalling NaN? Are two NaNs equal?
What is EnumSet? Why should you prefer EnumSet to perform int based bit flag operations?
What are the different ways to compare types in Java? What does the equality operator compare for the reference types? What does the equals method compare? When would you
prefer using the equals method to equality operator? What happens if a class does not override the equals method?
Why shouldn't you use the equality operator to compare float value? What is the preferred way to compare two float values? What should be the criteria to decide on the value of the
range that should be used to compare two float values?
Why should you use the equals method to compare String objects? What is the pitfall of using an equality operator to compare two String objects? What are interned strings? How
can you compare two interned strings?
What are the different ways to compare two enums? Explain why you can use both equality operator and equals method to compare enum? Which is the preferred way to compare
two enum values?
What are the advantages of using enum over public static int fields? Why do you need to perform extra validation with the int parameter as compared to the enum parameter? Why
should you prefer using an enum over a public static int?
What are the wrapper classes? What are the advantages of using the wrapper type over the primitive type? How can you use primitive types with collections?
What are auto boxing and auto unboxing? What are the advantages of auto boxing?
What are the BigInteger and BigDecimal types? How are the values of BigInteger and BigDecimal internally stored? What are the usages of BigInteger?
Why are String objects called Immutable? How is the String object created in memory? What are the advantages/disadvantages of String Immutability? Why are String objects
considered thread-safe? What are the advantages of declaring the String class final? What memory optimization is performed by the Java environment for strings? Why don't you
have to re-calculate the hash-code of the String object over the time it's used?
What is String literal? What are the differences between a String Literal and a String Object? How are the String Literals stored?
What is String interning? Can String Objects also be interned? What happens when you store a new String literal value that is already present in the string pool? What are the
drawbacks of creating a large number of String literals? Which one is preferred: String Object or String Literal? Why?
Explain String Pool Memory Management? How are String Literals stored in memory? How is String Pool optimized for memory? How are String Objects stored in memory? Why
can Java not use a String Pool-like mechanism to store objects of other types of data?
How are String literals cleared from the String Pool? Can you use reflection to clear a String object? What are the security issues associated with the immutable Strings? Why
should you not use Strings to store sensitive information such as passwords, access keys, etc.? What other data type can be used to store the password instead of String?
Can you override the String class to modify its immutability? Is it possible to circumvent string immutability? Is it recommended to circumvent string immutability using reflection?
Why?
What are the similarities and differences between StringBuffer and StringBuilder? When would you prefer StringBuffer to StringBuilder? Between StringBuffer and StringBuilder,
which one would you prefer in a single-threaded application?
What are Unicode characters? What are the advantages of using Unicode characters? What are the encoding systems problems which predominated before Unicode?
What is the inner class? What is the outer class? What are the advantages of defining an inner class? What are closures? How can inner classes be used to create closures? What
are callbacks? How can inner classes be used to create callbacks? Can an inner class access private members of the enclosing outer class? What benefit does the outer class bring?
What is a static nested class? Static classes, nested or outer, are the same; then what's the benefit of defining an inner class as static?
What is the difference between an inner class and a local inner class? Why can't you use an access modifier with the local inner class? Explain the rules for defining a local inner
class? What problem does a local inner class solve?
What is a non-static nested class? Why can a non-static nested class be used as closures? Can you create an instance of a non-static inner class without defining an outer class?
What is an anonymous inner class? How is an anonymous inner class different from the local inner class? Why shouldn't you return an inner class object from a method? If you
want to prevent anyone from using your class outside, which type of inner class should you define? Why should you avoid serialization of anonymous and inner classes?
What is a Function Interface? What are the benefits of using Functional Interface?
What is Lambda Expression? How are the Lambda Expression and Anonymous class-related? Can you pass Lambda Expression as a method parameter? What is the meaning of
deferred execution of functionality, using a Lambda Expression? What are the benefits of using Lambda Expression? How are the Lambda Expression and Functional Interface
related?
What is a Pure Function? What is the use of Pure Function in Functional Programming? How is the Pure Function guaranteed to always return the same results for the same
arguments?
What is the Fluent Interface? What are the benefits of defining and using Fluent Interface? Describe some usage of Fluent Interface?
What is Type Wildcard in Generics? Explain the Upper Bound type wildcard? Explain Lower Bound type wildcard? How are the different types of wildcards used in generics? What
is automatic type inference in Generics? What is the diamond operator in Generics?
Explain the Generics method? Can you add a Generic method to a non-Generic type? What are the benefits of defining the bounded type as method parameters? How is compile
type safety enforced by Generics?
What are the reifiable types? Why can't you assign a Generic collection object of subtype to a Generic collection object of super-type? Why is it allowed to assign an array object of
subtype to an array object of super-type? Are Java arrays more polymorphic?
What are non-reifiable types? What is type erasure? What would happen if type erasure is not there?
Explain covariance? Why can't you add an element of subtype to a generic defined with upper bound type wildcard?
Explain contra-variance? Why can't you read an element from a Generic defined with a lower bound type wildcard?
When should you use covariance? When should you use contra-variance?
Explain collections? How are collections and Generics related? Can you use collections with primitive types? How can you use collection with the primitive types? Explain the
difference between collections and arrays? What is the benefit of the collection framework? What are the different components of the collection framework?
Why should you write code against the collection interface and not concrete implementation?
What are the different collection types? Define Set collection Type? Define List collection Type? Define Queue collection Type? Define Deque collection Type? Define Map
collection Type? What is the difference between Queue and Deque?
Can you add duplicate elements in a Set? Which collections type should you use when ordering is not a requirement? Why? Can you add a null element to a Set? Which Set class
should you use to maintain the order of insertion? What happens to the order, if the same element is inserted again in a Set? Will it maintain its original position or be inserted in the
end? Which Set class should you use to ensure the ordering of the elements? Which Set class should you use when you need to traverse in both the directions?
Can you add duplicate elements to a List? Can you add null to a list? In which scenarios would you use ArrayList in: frequent add/update or frequent reading? In which scenarios
would you use LinkedList in: frequent add/update or frequent reading? Which one takes up more memory between ArrayList and LinkedList? Why? Between ArrayList and
LinkedList, which one would you prefer if you need random access? Why?
What is the purpose of the Queue? How is Deque different from Queue? What is a priority queue? What criteria should be used to delete an item from the priority queue? What is a
Delay Queue? What is a Blocking Queue? Which Queue is a thread-safe queue? Which Queue implements the Producer-Consumer pattern? Explain the difference between the
Blocking Queue and the Transfer Queue? Which Queue is capacity bounded, allowing only the specified number of elements in Queue? What happens if you try to put more than the
capacity?
How is the Map different from other collections? Can you add a null value as the key to a Map? Can you guarantee ordering of elements in HashMap? How HashMap can provide
constant-time performance for the get() and the put() operations. What is the difference between HashMap and LinkedHashMap? If the insertion order is to be maintained, which
one should you use: LinkedHashMap or HashSet? Why? What is WeakHashMap? If you want to maintain the ordering of keys, which Map class should you use? Which Map class
should you use to access it in both ascending and descending order? Which Map implement is optimized for thread safety? How does ConcurrentHashMap enforce scalability, with
good efficiency still maintained? Why the key used for Map and value used for Set should be of immutable type? What are the disadvantages of exposing an internal collection
object to the caller? Which collection is best for traversing in sorted order?
What are the different algorithms supported by the collection framework? Which search algorithm is used to search keys? How is the shuffling algorithm used?
What is the difference between the Comparable Interface and Comparator Class? When should you implement Comparable Interface to sort a collection? When do you use the
Comparator Class to sort a collection?
What are the different collection types in Java that use hashCode and equals methods? Why do these collections type use hashCode and equals method? If you override the
hashCode method, why should you always override the equals method too? The hashCode method is already present in the java.lang.Object class, why should you override it? Why
does an object have to return the same hash-code value every time during its lifetime? Is it necessary that an object returns the same hash-code every time a program runs? Is it
necessary that two equal objects return the same hash-code? Can two objects, that are not equal, still have the same hash-code? What is the purpose of calculating hash-code?
What is the purpose of the equals method? If two objects have the same hash code, how are these stored in hash buckets? If two objects have different hash codes, do you still need
to implement an equals method? If there are two objects with the same hash code, then how the equals method is used?
What is the purpose of HashTable and HashMap? What is the difference between HashTable and HashMap? How do HashTable and HashMap store objects? Why is HashMap
better for single-threaded applications? Why is the performance of HashMap better than HashTable? How can you use HashMap in a multi-threaded environment?
What is the purpose of Synchronized and Concurrent collections? What is collection synchronization? What is collection concurrency? How do you achieve collection
synchronization? How do you ensure coordinated collection access when a composite operation needs several methods to complete the task? How do you achieve collection
concurrency? How does ConcurrentHashMap offer multiple threads concurrent access to the same collection? Why is the performance of ConcurrentHashMap better even though it
allows simultaneous writes from multiple threads? What would you prefer between the ConcurrentHashMap and the HashTable? Why?
Explain different ways to iterate over collections? Can you modify the collection structure while iterating using a for-each loop? Can you modify a collection element value while
iterating using a for-each loop? What are the limitations with the for-each loop, regarding the navigation direction? What is different between the for-each loop and the Iterator,
regarding the navigation direction? Can you modify the collection structure while iterating using an Iterator? Can you modify a collection element value while iterating using an
Iterator? Between the for-each loop and the for loop, which one should you prefer? Why? Why are Iterators considered more thread-safe? Explain the concept of Data Independent
Access of the collection? How can you design your class to provide Data Independent Access to the collections used in the class?
What is the term fail-fast used in collection iteration? What is the benefit of a fail-fast iterator? What is a fail-safe iterator?
What is an exception? What are the root level exception super classes in Java? Which superclass should you subclass to create a checked exception? Which superclass should you
subclass to create unchecked exceptions?
What are the checked exceptions? What are unchecked exceptions? What types of exceptions does the Error class in Java define? How can you handle checked exceptions? What
happens if an exception is unhandled? What are the different ways to handle checked exceptions? Which exception classes will you use in the catch block to handle both: checked
and unchecked exceptions? How do you choose between checked and unchecked exceptions? Can you recover from unchecked exceptions? How can you avoid unchecked
exceptions? Can you throw checked exceptions from the static initializer block? Why? You cannot throw because there is no specific place to catch it and it's called only once. You
have to use try/catch to handle checked exceptions . What should you do to handle an Error?
Describe some exception handling best practices? What are the pitfalls of suppressing an exception? What is the problem with showing a generic error message? What is the
downside of swallowing as an exception? What are the pitfalls of handling multiple exceptions in a single catch block? What would you do if an exception is thrown from a source
that contains sensitive information? What would you log in such a case and what message would you show to the user? What is the pitfall of wrapping all the exceptions into a
Generic exception class? Why shouldn't you use exceptions to control the flow of program execution? Should you log all the exceptions? Why? Why shouldn't you use Throwable or
some other root level class to catch exceptions? What criteria should be used to decide which block of code should be included in the try block? If a nested call is made that goes
through multiple methods, would you be using a try-catch for each method? Why?
Which java construct can you use to close the system resources automatically? Which Interface resources must inherit to use a class object within a try-with-resource construct?
What is a thread? What is a program? What is a process? What is the difference between a thread and a process? What is the difference between program and process? Explain
context switching of thread? What is parallel processing? What is multithreading? How is parallel processing and multithreading related? What is a deadlock? What is a user
thread? What is thread-local storage? What type of objects should you store with thread local storage? Do threads share stack memory?
Describe the different stages of the thread lifecycle? What is the difference between the blocked state and the waiting state? How can you find a thread state? How is thread sleep
different from thread wait?
Define a good strategy to terminate a thread? What is thread interrupt? How is the thread's interrupt method different from the thread stop method? What happens if a thread is
sleeping and you call interrupt on the thread? Does calling interrupt stop the thread immediately?
What are the different ways to create a thread? How implementing the Runnable interface is different from extending Thread class? When should you extend the Thread class? When
should you inherit Runnable Interface? Which one is the preferred way between Runnable and Thread? Does implementing Runnable create a thread? Both Thread class and
Runnable Interface have run methods, what is the difference?
What is the difference between the Callable and Runnable interface? What is the benefit of using Runnable vs Callable? Can you throw checked exceptions from the Runnable
interface? Why are Runnable and Callable interfaces called Functional Interfaces? Which Interface returns the result: Runnable or Callable?
What is a daemon thread? What is a user thread? What is the main thread? Can a program exit if the daemon thread is still running? Can a program exit if the user thread is still
running? Does a finally block on a Daemon thread still get a chance to execute When THE JVM halts exiting all the Daemon thread? When a new thread is created; is it created as
a user thread or a Daemon thread? What happens if no user thread is running but a Daemon thread is still running? What is Java's main thread: a user thread or a Daemon thread?
What type of thread is created when you create a new thread on a main thread: daemon or user? What kind of work can you use Daemon thread for?
How immutable objects help to prevent race conditions? Why is race condition capable of generating unpredictable results? Why are immutable objects considered safe in a
multi-threaded environment? Why is it suggested to declare an immutable class as final? Why should it be the only way to construct an immutable object? What happens if setters
are provided?
What is a thread pool? How does a thread pool reduce the overhead of thread creation? How does a thread pool help to prevent an application from hanging or crashing? What is a
fixed thread pool and how is it created? How does the thread pool enable loosely coupled design?
Explain concurrent processing? Explain parallel processing? Explain asynchronous processing? Explain the difference between concurrent and parallel processing? Does parallel
processing require multiple threads? When an application is concurrent but not parallel? When an application processes multiple operations simultaneously without dividing these
operations further into smaller tasks. When an application is parallel but not concurrent? When an application processes one operation dividing the operation into smaller tasks
that are processed in parallel. When an application is neither concurrent, nor parallel? When an application processes only one operation without dividing the operation into
smaller tasks? When an application is both concurrent and parallel? When an application processes multiple operations simultaneously and also dividing these operations further
into smaller tasks that are processed in parallel?
Explain race conditions in multithreading? What is a critical section? What is thread synchronization? What is a memory barrier? What is the concept of happen-before in thread
synchronization?
How is the synchronized keyword used? What is the difference between synchronized methods and synchronized blocks? Why is the synchronized block preferred to the synchronized
method? Does the synchronized method lock the entire object? What happens if you call a method supported by the client from within a synchronized block or process?
What is conditional synchronization? What is the purpose of the wait call? What is the difference between notify and notifyAll method? With multiple threads waiting for the
notification, which one will be notified when you call to notify? Which one should you prefer between notify and notifyAll ? Why?
What is a volatile variable? Explain the problem that volatile fields solve? Where are the volatile variables stored?
What are the static variables? All the objects of a class share static variables. But in a multi-threaded environment; why is a change made by one object to the static variable not
visible to an object on another thread? If both static and volatile variables are shared between objects, then what's the problem a volatile variable solves? How are volatile and
static variables different from the synchronized, since even the synchronized monitor guards memory objects too?
What is thread-local storage? What are the things you should store in Thread Local Storage? Why shouldn’t you synchronize the access to the objects that are stored in ThreadLocal
Storage? Why should you remove objects from Thread Local Storage?
What is the difference between wait and sleep? Why is it possible to notify the waiting object but not the sleeping? As you need to handle a sleeping thread to wake it; do you need
direct access to a waiting object too? Why? What is the mechanism to signal an object to come out of wait?
What is the purpose of the thread's join method? Why do you need to join two threads?
What are the atomic classes? Why don't you need to synchronize access to an object of the atomic class? Why are pre and post-increment operators not thread-safe? Pre and
post-operation are multiple operations under the hood- read, increment, and write. All three are not synchronized together, so any thread context switch that happens in between will
result in undesired results. What is the difference between Atomic and Volatile variables?
Explain the locking mechanism in a multi-threaded environment? Do you need to acquire and release locks in the same block of code? Why should you prefer using tryLock()
instead of a lock()?
What are the benefits of using ReadWriteLock? In which scenarios should you prefer ReadWriteLock over other locking mechanisms?
What is the purpose of synchronizers? What are the different types of synchronizers available in Java?
Explain Barrier synchronizer? Can you reuse the same Barrier object again? How? What if one of the threads, which other threads await a Barrier, dies? What job do you use
Barrier for?
Explain Semaphore synchronizer? What happens if you call release() more time than acquire()? What happens when you call acquire, but permits are not available? How can you
acquire a mutually exclusive lock using Semaphore? Where do you use Semaphore?
Explain Phasor synchronizer? What is special about Phasor regarding the number of parties that can register with it? Can you reuse the same Phaser object again? Can you
monitor the count of Phasor monitors using some external object who is not registered as a party with the Phaser? What is the difference between Semaphore and Phaser?
Explain Exchanger synchronizer? How many threads are required with the Exchanger object? What is the primary purpose of the Exchanger synchronizer? Does the Exchanger
synchronizer use the same object to exchange every time or a different object can be exchanged?
Explain Latch synchronizer? Can you reuse the same Latch object again; like Barrier and Phaser? What is the signaling process when a thread finishes its work?
Explain the Executor framework? What are the different capabilities of the Executor framework?
Explain ExecutorService? How do you track the progress and status of the executing tasks? Does Executor service use dedicated threads to execute queued tasks? Can you use a
Runnable object with ExecutorService? Why? How do you find if an exception is thrown in the ExecutorService? Can you schedule a task to run in the future with the
ExecutorService? With ExecutorService, how can you get results from the multiple tasks? What is the difference between submit() and execute() methods of ExecutorService? How
can you exit gracefully from ExecutorService? What should be the criteria for configuring thread pool size? How can you set that?
Explain the Fork-Join framework in Java? How does the Fork-Join framework help to optimize task execution? What is the difference between RecursiveTask and RecursiveAction?
What is reflection? What are the different scenarios where reflection can be used? How do debuggers use reflection? How can reflection help in creating modular software
architecture? Can you access private members using reflection? Give some examples, where reflection is used in software development libraries, tools, and frameworks?
When should you use reflection? How does reflection violate encapsulation? How does reflection violate abstraction? Why is reflection considered slow? Why is reflection code
considered fragile and can break?
What is JSON? What is the main reason for JSON's popularity? What are the significant differences between JSON and XML data formats? Why has JSON become the preferred
format for data interchange? Explain the difference between JSON Object and JSON Array?
What is a stack? What is a heap? During its lifecycle how is the memory allocated and de-allocated in a stack? When does the stack memory get released? When does the heap
memory get released? Why is memory allocation in a stack faster compared to the heap? Why do you need to apply synchronization to the heap memory and not to the stack
memory? What exception do you get when stack memory is exhausted? What exception do you get when heap memory is exhausted? Do you need to explicitly release the objects on
the stack?
What is heap fragmentation? Why does heap fragmentation happen? Who has the responsibility to reduce heap fragmentation? How can you control heap fragmentation? What
happens when there is a very high level of heap fragmentation? Why does heap fragmentation slow down the application?
What are serialization and deserialization? Which interface needs to be implemented by the type that wants to support serialization? How can you prevent a member from
serialization? Which classes in Java are used to serialize and deserialize objects?
What is Garbage Collection? Explain the Garbage Collection cycle? Why is Garbage Collection considered an expensive process? Why does the Garbage Collection cycle improve
the performance of an application? How does Garbage Collection prevent OutOfMemoryException? Which type of thread is used for Garbage Collection: Daemon or user thread?
What is memory fragmentation? Why does the application seem to slow down when Garbage Collection happens? Can you explicitly request a Garbage Collection? Which methods
can you call to request Garbage Collection? Does Garbage Collection always happen when requested?
How is Heap memory divided? Explain different generations of heap memory? How objects are moved across generations? How is the garbage collection cycle triggered? What are
Eden and Survivor spaces in New Generation memory? When do the objects in Eden move to Survivor space? What is Metaspace? What is the type of things stored in Metaspace?
Why does Metaspace have virtually unlimited space? In which generation is the Garbage Collection cycle running slowest? Why? Which generation is more frequently garbage
collected?
What is a weak reference? What is a soft reference? What is Phantom Reference? What are the various reference types that get collected by the Garbage Collector, even when the
objects of their types are still in use? What is the difference between soft reference and weak reference? What is the typical usage of weak reference? What is the typical usage of soft
reference? What is the typical usage of Phantom reference? Which is collected first: soft reference or weak reference?
Why unit testing? What are the benefits of unit testing? How does unit testing save time in the long run? How can you use unit testing to document the coding scenarios?
What is unit testing? What is integration testing? What is regression testing? How are the differences between integration testing and regression testing? What is validation testing?
What are the different ways to test private members? Can you use Reflection to test private members? Why shouldn't you use reflection to test private members? What are the
various methods to test private members?
What are mock objects? What are the benefits of using mock objects? Why do mock objects help to speed up the tests? Why should you use mock objects for unit testing? What are
the types of dependencies that you should replace with mock objects?
What are distributed version control systems? Why do you use a version control system? What are the typical activities you perform with a version control system? Explain the
branching strategy of code?
Why should you need a framework for dependency resolution - you can manually download the files and add a reference? What all things does Maven support? Why is Maven said
to be convention-based? What is the meaning of goals in Maven?
What is Continuous Integration? What are the different activities that the Continuous Integration framework should support? Explain the capabilities of Jenkins to support
Continuous Integration? How do you integrate third-party tools with Jenkins?