Sign in to unlock

Get unlimited access to all questions and answers

checked

Get lifetime access

checked

Track progress

checked

Save time

👋

Hi! Please sign in to edit.

You will receive an email notification when your contribution is accepted.

The fastest way to prepare
for a tech interview

Check our curated list of full-stack, data structures & software architecture interview questions and answers for developers

* If it's yours original answer, you can add a link to your social media account or personal website.
Java interview questions

Java interview questions.

Only challenges
Topic progress: 0%
1.

What are the two types of Exceptions in Java? Which are the differences between them?

premium question
completed

Answer:

2.

What is JVM? Why is Java called the “Platform Independent Programming Language”?

premium question
completed

Answer:

3.

What is the difference between an Applet and a Java Application?

premium question
completed

Answer:

4.

What is the Difference between JDK and JRE?

premium question
completed

Answer:

5.

What is a Servlet?

premium question
completed

Answer:

6.

What is a JSP Page?

premium question
completed

Answer:

7.

What are Directives?

premium question
completed

Answer:

8.

What does System.gc() and Runtime.gc() methods do?

premium question
completed

Answer:

9.

What differences exist between HashMap and Hashtable?

premium question
completed

Answer:

10.

What is JDBC?

premium question
completed

Answer:

11.

What does the “static” keyword mean? Can you override private or static method in Java?

premium question
completed

Answer:

12.

What is the importance of finally block in exception handling?

premium question
completed

Answer:

13.

What is the difference between Exception and Error in java?

premium question
completed

Answer:

14.

When does an Object becomes eligible for Garbage collection in Java ?

premium question
completed

Answer:

15.

What is an Iterator?

premium question
completed

Answer:

16.

What are pass by reference and pass by value?

premium question
completed

Answer:

17.

What is an Java Applet?

premium question
completed

Answer:

18.

How HashMap works in Java?

premium question
completed

Answer:

19.

What are the basic interfaces of Java Collections Framework?

premium question
completed

Answer:

20.

What are the Data Types supported by Java? What is Autoboxing and Unboxing?

premium question
completed

Answer:

21.

What is the difference between processes and threads?

premium question
completed

Answer:

22.

What will happen to the Exception object after exception handling?

premium question
completed

Answer:

23.

What is the difference between an Interface and an Abstract class?

premium question
completed

Answer:

24.

What are Expressions?

premium question
completed

Answer:

25.

What do you know about the big-O notation and can you give some examples with respect to different data structures?

premium question
completed

Answer:

26.

What is Function Overriding and Overloading in Java?

premium question
completed

Answer:

27.

How are the JSP requests handled?

premium question
completed

Answer:

28.

What is the design pattern that Java uses for all Swing components?

premium question
completed

Answer:

29.

What is the purpose Class.forName method?

premium question
completed

Answer:

30.

What is the purpose of garbage collection in Java, and when is it used?

premium question
completed

Answer:

31.

What’s the difference between sendRedirect and forward methods?

premium question
completed

Answer:

32.

What are Decalarations?

premium question
completed

Answer:

33.

What are JSP actions?

premium question
completed

Answer:

34.

What is reflection and why is it useful?

premium question
completed

Answer:

35.

Explain the architechure of a Servlet.

premium question
completed

Answer:

36.

Explain Serialization and Deserialization.

premium question
completed

Answer:

37.

How does Garbage Collection prevent a Java application from going out of memory?

premium question
completed

Answer:

38.

How do I efficiently iterate over each entry in a Java Map?

premium question
completed

Answer:

39.

What is a Constructor, Constructor Overloading in Java and Copy-Constructor?

premium question
completed

Answer:

40.

What is the role of stub in RMI?

premium question
completed

Answer:

41.

What is the difference between doGet() and doPost()?

premium question
completed

Answer:

42.

What is the difference between GenericServlet and HttpServlet?

premium question
completed

Answer:

43.

Explain the life cycle of a Servlet.

premium question
completed

Answer:

44.

What is structure of Java Heap?

premium question
completed

Answer:

45.

What differences exist between Iterator and ListIterator?

premium question
completed

Answer:

46.

Explain the role of Driver in JDBC.

premium question
completed

Answer:

47.

What is the relationship between an event-listener interface and an event-adapter class?

premium question
completed

Answer:

48.

What is the applet security manager, and what does it provide?

premium question
completed

Answer:

49.

What is the difference between throw and throws?

premium question
completed

Answer:

50.

What happens when an applet is loaded?

premium question
completed

Answer:

51.

When is the finalize() called? What is the purpose of finalization?

premium question
completed

Answer:

52.

Can you access non static variable in static context?

premium question
completed

Answer:

53.

What is a Server Side Include (SSI)?

premium question
completed

Answer:

54.

Why Collection doesn’t extend Cloneable and Serializable interfaces?

premium question
completed

Answer:

55.

Explain the life cycle of an Applet.

premium question
completed

Answer:

56.

Which Swing methods are thread-safe?

premium question
completed

Answer:

57.

What is the tradeoff between using an unordered array versus an ordered array?

premium question
completed

Answer:

58.

What is Comparable and Comparator interface? List their differences.

premium question
completed

Answer:

59.

What are untrusted applets?

premium question
completed

Answer:

60.

What are the restrictions imposed on Java applets?

premium question
completed

Answer:

61.

What is the difference between an Applet and a Servlet?

premium question
completed

Answer:

62.

How does finally block differ from finalize() method?

premium question
completed

Answer:

63.

What’s a deadlock?

premium question
completed

Answer:

64.

What are Scriptlets?

premium question
completed

Answer:

65.

What’s the difference between Enumeration and Iterator interfaces?

premium question
completed

Answer:

66.

What is difference between ArrayList and LinkedList ?

premium question
completed

Answer:

67.

What are the steps involved to make work a RMI program?

premium question
completed

Answer:

68.

Does Java support multiple inheritance?

premium question
completed

Answer:

69.

If an object reference is set to null, will the Garbage Collector immediately free the memory held by that object?

premium question
completed

Answer:

70.

What is the importance of hashCode() and equals() methods?

premium question
completed

Answer:

71.

Explain different ways of creating a thread. Which one would you prefer and why?

premium question
completed

Answer:

72.

What is Java Priority Queue?

premium question
completed

Answer:

73.

What is difference between fail-fast and fail-safe?

premium question
completed

Answer:

74.

What is difference between Array and ArrayList ? When will you use Array over ArrayList?

premium question
completed

Answer:

75.

What is the advantage of PreparedStatement over Statement?

premium question
completed

Answer:

76.

What is meant by JSP implicit objects and what are they?

premium question
completed

Answer:

77.

How threadsafe is enum in Java?

premium question
completed

Answer:

78.

What are the differences between == and equals?

premium question
completed

Answer:

79.

Is there anything like static class in java?

premium question
completed

Answer:

80.

Compare the sleep() and wait() methods in Java

premium question
completed

Answer:

81.

How and where are Annotations used in Java?

premium question
completed

Answer:

82.

What is the difference between final, finalize and finally?

premium question
completed

Answer:

83.

What is the main difference between StringBuffer and StringBuilder?

premium question
completed

Answer:

84.

What’s the difference between a ClassNotFoundException and NoClassDefFoundError?

premium question
completed

Answer:

85.

How can I synchornize two Java processes?

premium question
completed

Answer:

86.

How do I break out of nested loops in Java?

premium question
completed

Answer:

87.

What are the advantages of JSP?

premium question
completed

Answer:

88.

What is the JIT?

premium question
completed

Answer:

89.

What is a JavaBean exactly?

premium question
completed

Answer:

90.

Can an enum be extended?

premium question
completed

Answer:

91.

What is the Java Classloader?

premium question
completed

Answer:

92.

What is the volatile keyword useful for?

premium question
completed

Answer:

93.

What is the difference between HashMap, LinkedHashMap and TreeMap in Java?

premium question
completed

Answer:

94.

What is the difference between public, protected, package-private and private in Java?

premium question
completed

Answer:

95.

What's the advantage of using getters and setters?

premium question
completed

Answer:

96.

What is static initializer?

premium question
completed

Answer:

97.

Is Java “pass-by-reference” or “pass-by-value”?

premium question
completed

Answer:

98.

Why does Java have transient fields?

premium question
completed

Answer:

99.

What do the ... dots in the method parameters mean?

premium question
completed

Answer:

100.

Can == be used on enum?

premium question
completed

Answer:

101.

What is the use of CallableStatement? Name the method, which is used to prepare a CallableStatement.

premium question
completed

Answer:

102.

How do I read/convert an InputStream into a String in Java?

premium question
completed

Answer:

103.

What is Perm Gen space in Heap?

premium question
completed

Answer:

104.

What is the difference between applets loaded over the internet and applets loaded via the file system?

premium question
completed

Answer:

105.

What is the role of the java.rmi.Naming Class?

premium question
completed

Answer:

106.

What is the purpose of using RMISecurityManager in RMI?

premium question
completed

Answer:

107.

How do you ensure that N threads can access N resources without deadlock?

premium question
completed

Answer:

108.

What are some of the best practices relating to the Java Collection framework?

premium question
completed

Answer:

109.

What is meant by binding in RMI?

premium question
completed

Answer:

110.

What is the role of Remote Interface in RMI?

premium question
completed

Answer:

111.

What is the difference between a synchronized method and a synchronized block?

premium question
completed

Answer:

112.

Explain the available thread states in a high-level.

premium question
completed

Answer:

113.

What is the difference between Serial and Throughput Garbage collector?

premium question
completed

Answer:

114.

What is the applet class loader, and what does it provide?

premium question
completed

Answer:

115.

Explain Marshalling and demarshalling.

premium question
completed

Answer:

116.

How do you find out what client machine is making a request to your servlet?

premium question
completed

Answer:

117.

What is Servlet Chaining?

premium question
completed

Answer:

118.

What is the basic principle of RMI architecture?

premium question
completed

Answer:

119.

What does Connection pooling mean?

premium question
completed

Answer:

120.

What is Double Brace initialization in Java?

premium question
completed

Answer:

121.

How do I test a private function or a class that has private methods, fields or inner classes?

premium question
completed

Answer:

122.

Why is char[] preferred over String for passwords?

premium question
completed

Answer:

123.

What is RMI?

premium question
completed

Answer:

124.

What exactly is marker interface in Java?

premium question
completed

Answer:

125.

What are the differences between a HashMap and a Hashtable in Java?

premium question
completed

Answer:

126.

When to use LinkedList over ArrayList in Java?

premium question
completed

Answer:

127.

Why is Spring MVC better than Servlets / JSP ?

premium question
completed

Answer:

128.

Explain a use case for the Builder Design Pattern

premium question
completed

Answer:

129.

Does Java support default parameter values?

premium question
completed

Answer:

130.

What is the main difference between an inner class and a static nested class in Java?

premium question
completed

Answer:

131.

What is DGC ? And how does it work?

premium question
completed

Answer:

132.

What is the difference between HashSet and TreeSet?

premium question
completed

Answer:

133.

How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

premium question
completed

Answer:

134.

Does Garbage collection occur in permanent generation space in JVM?

premium question
completed

Answer:

135.

What are the layers of RMI Architecture?

premium question
completed

Answer:

136.

What does 'synchronized' mean?

premium question
completed

Answer:

137.

What's wrong with Double Brace initialization in Java?

premium question
completed

Answer:

138.

Why isn’t String‘s .length() accurate?

premium question
completed

Answer:

139.

Compare volatile vs static variables in Java

premium question
completed

Answer:

140.

What is an efficient way to implement a singleton pattern in Java?

premium question
completed

Answer:

141.

What's the difference between SoftReference and WeakReference in Java?

premium question
completed

Answer:

142.

Why ArrayList are preferable in many more use-cases than LinkedList?

premium question
completed

Answer:

143.

Provide some examples when a finally block won't be executed in Java?

premium question
completed

Answer:

144.

Is null check needed before calling instanceof?

premium question
completed

Answer:

145.

Is it possible to call one constructor from another in Java?

premium question
completed

Answer:

146.

Given two double values d1, d2, what is the most reliable way to test their equality?

premium question
completed

Answer:

147.

Explain what will the code return

premium question
completed

Answer:

Reverse Tech Interview: Questions to Stump an Interviewer

Few people want to get into an uncomfortable environment or an unprofitable company with no prospects. If you’re wondering how to get a real feel for a company during an interview, you’re welcome. I’ll give a list of questions that interviewers don’t usually expect...

How to become a programmer, move to the US, and get a dream job

Are you curious about what you need to do to earn more than $15.000 a month, drive a Tesla, live in sunny California, and work at Google, Apple, Facebook, or Amazon?

11 Reactive Systems interview questions and answers for software engineers . Reactive Systems

Reactive systems are an architectural style that allows multiple individual applications to blend into one unit, reacting to their environment, while staying aware of each other. Here is a list of coding interview questions on Reactive Systems to help you get ready...

34 Microservices interview questions and answers for software engineers

Microservice architecture – a variant of the service-oriented architecture structural style – arranges an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. Here is a list of coding intervie...

. Microservices
7 Layering & Middleware interview questions for developers

Middleware in the context of distributed applications is software that provides services beyond those provided by the operating system to enable the various components of a distributed system to communicate and manage data. Middleware supports and simplifies complex distributed application...

. Layering & Middleware
55 Docker interview questions and answers for software engineers

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Here is a list of coding interview questions on Docker to help you get ready for your next data structures interview in 2021.

. Docker
23 Databases interview questions and answers for software engineers

A database is an organized collection of data, generally stored and accessed electronically from a computer system. Where databases are more complex they are often developed using formal design and modeling techniques. Here is a list of coding interview questions on Databases to help you g...

. Databases
21 Concurrency interview questions and answers for software engineers

In computer science, concurrency is the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome. Here is a list of coding interview questions on Concurrency to help you get ready for your n...

. Concurrency
13 CAP Theorem interview questions and answers for software engineers

In theoretical computer science, the CAP theorem, also named Brewer's theorem after computer scientist Eric Brewer, states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees: Consistency: Every read receives the ...

. CAP Theorem
18 Caching interview questions and answers for software engineers

Caching is a technique that stores a copy of a given resource and serves it back when requested. Here is a list of coding interview questions on Caching to help you get ready for your next data structures interview in 2021.

. Caching
Load more posts

Features

folder icon

Access all answers

Get the inside track on what to expect in your next tech interview. We offer you a collection of high quality technical interview questions to help you prepare for your next coding interview.

graph icon

Track progress

A smart interface helps you track your progress and focus on the topics you need. You can search through questions or sort them by difficulty or type.

clock icon

Save time

Save tens of hours searching for information on hundreds of low-quality sites designed to drive traffic and make money from advertising.

Land a six-figure job at one of the top companies.

amazon logo facebook logo google logo microsoft logo uber logo
Prepare for a technical interview

Get hired with our
tech interview questions & answers