Java Interview Questions and Answers Includes Java Version Till Java 12 (BooxRack)
Java Interview Questions and Answers Includes Java Version Till Java 12 (BooxRack)
Answers
Pratik Bandal
About Book
Java Interview Questions and Answers is extremely useful for
beginners and professionals who are preparing for interview of Java.
This book covers interview questions of Java which is an all-time
favourite programming language of the world. The book will prepare
you for interview as well as refining your knowledge of Java and will
make you ready for working in industry.
For any positive or negative feedback regarding this book, kindly reach
me at pratikbandal007@gmail.com
About Author
I am Pratik Bandal currently working in a big multinational company
and have over 7 years of experience in software industry. I have done
B.E. and Post graduate diploma in Advanced Computing. I have
experience in different domains like healthcare, payment and banking
sectors.
But on top of all, I am developer like you all guys doing an 8 hour job.
Writing is something I do extra and I love doing it. No one is perfect
and holds true for me as well. Without all you guys I am not an author.
Writing an interview question book is a really great deal of
responsibility. But huge natural variations in interview are something
difficult to cover in this small book.
Contents
1. Fundamentals
1. What is Java?
2. What are features of Java?
3. What is JDK?
4. What is difference between Oracle JDK and openJDK?
5. What is JRE?
6. What is JVM?
7. What is Delegation while class loading?
8. What is JIT compiler?
9. Is Java fully object oriented?
10. What is OOPS?
11. What are basic principles of OOPS?
12. Which component in JVM will allocate memory to Java program?
2. Classes and Objects
13. What is class?
14. What does Java Object mean?
15. What are object references?
16. What are different types of references in Java?
17. Explain access modifiers in Java.
18. What is encapsulation? Explain with real life example.
19. What is this keyword?
20. Is it possible to assign reference to this?
21. What are differences between this and super keyword?
22. What is package?
23. Can we import same class two times?
24. What is static import?
25. What does public static void main (String args[]) signify?
26. What is final variable?
27. What happens when you instantiate this class?
28. What is the default value of the local variables in Java?
3. Garbage Collector
29. How garbage collector manages heap memory?
30. Which algorithm is used by garbage collector?
31. How do you identify minor and major garbage collection in Java?
32. How is Garbage Collection managed?
33. What is purpose of System.gc() and Runtime.gc() methods?
34. When is the finalize() called ? Why it is protected?
35. Which part of memory is involved in Garbage collection?
36. What are different types of garbage collectors?
37. Will garbage collection guarantee that a program won’t run out of
memory?
38. What is pass by value and pass by reference?Does Java use pass by
value or pass by reference?
39. What is Garbage collector interface introduced in Java 10?
40. What is Parallel Full GC for G1 in Java 10?
41. What is bytecode Generation for Enhanced for Loop in Java 10?
42. What is Epsilon Garbage Collector introduced in Java 11?
43. What is Shenandoah in Java 12?
44. How many objects are eligible for garbage collection, after line 8 runs?
4. String
45. What is string?
46. Is string class or data type?
47. What is difference between == and equals()?
48. Why is string immutable?
49. What is string constant pool?
50. Why string should be created using string literal?
51. When to use Stringbuffer over String?
52. What is difference between stringbuffer and stringbuilder?
53. How to create immutable class?
54. What is StringJoiner introduced in Java 8?
55. What are new String methods introduced in Java 11?
56. What are Strings new methods introduced in Java 12?
57. Write String Palindrome program.
5. Methods and Constructors
59. What is constructor?
60. What are types of constructor?
61. Explain the difference between constructor and object?
62. Why constructor are not inherited?
63. Why constructors cannot be final?
64. Can constructors be static?
65. Can we overload constructor?
66. Can we clone Object without using cloneable interface?
67. Can we override constructor?
68. Why do constructors not return values?
69. What is constructor chaining?
70. What is difference between this and super?
71. Why can't this() and super() both be used together in a constructor?
72. What is the static variable?
73. What is static method?
74. Can a Non-Static Method Access a Static Variable/Method in Java?
75. Why can't a static method (directly) access non-static members?
76. Why is the main method static?
77. Can you remove static modifier from the signature of the main method?
78. Can abstract class have static methods?
79. Is it possible to use this in static blocks?
80. Can we use this in static methods?
81. What happens when you call someMethod() in the below class?
6. Inheritance
82. What is inheritance?
83. Why do we use inheritance?
84. Private members of a class are inherited to sub class?
85. What is real life example of inheritance?
86. Why is Object class superclass of all the classes?
87. Why is multiple inheritance not supported in java?
88. What is the Association?
89. What is aggregation?
90. What is composition in Java?
91. What is difference between aggregation and composition?
92. What is difference between inheritance and composition?
93. What is final method?
94. What is final class?
95. What is output of below program?
7. Polymorphism
96. What does Polymorphism mean?
97. What is real world example of Polymorphism?
98. What are types of polymorphism?
99. What is method overloading?
100. What is method overriding?
101. What is difference between method overloading and overriding?
102. Is method overloading by changing the return type possible?
103. Why doesn't Java allow overriding of static methods?
104. Can you write virtual methods in Java?
105. What is variable hiding?
106. Why data member overriding is not allowed?
107. What is covariant return type?
108. What will be the output of the following program?
8. Abstract Classes and Interfaces
109. What is abstraction?
110. What is abstract class?
111. What is use of abstract method?
112. Can you make abstract class final?
113. Why does abstract class cannot be instantiated but have constructor?
114. What is an interface?
115. Why interface method cannot be final?
116. What is default method?
117. How to resolve conflict caused by default methods of same signature?
118. Why interface cannot be final?
119. What is marker interface?
120. What is use of marker interface?
121. Why methods of interface are public and abstract by default?
122. Can you implement one interface from another?
123. Is it possible to create an inner class within an interface?
124. What is functional interface?
125. What is difference between interface and abstract class?
126. For every interface written in a java file, .class file will be generated
after compilation? True or False?
127. What is private interface methods in Java 9?
128. What is functional interface introduced Java 8?
129. Why the below code is showing compile time error?
9. Wrapper Classes
130. What are wrapper classes?
131. Why we need wrapper classes?
132. What is Autoboxing and Unboxing?
133. When to use wrapper class and primitive type?
134. Are wrapper classes immutable?
135. What happens when you override someMethod(int) as
someMethod(Integer) like in the below example?
136. Write program to find Factorial of a number using BigInteger.
10. Serialization
137. What is serialization and deserialization?
138. What is SerialVersionUID?
139. What is need for serialization?
140. What happens if the object to be serialized includes the references to
other serializable objects?
141. What happens if an object is serializable but it includes a reference to
a non-serializable object?
142. What is the difference between Serializable and Externalizable
interface in Java?
143. Which kind of variables is not serialized during Serialization?
11. Exception Handling
145. What is exception handling?
146. Explain exception hierarchy?
147. What is difference between checked and unchecked exception?
148. What is difference between throw and throws keyword?
149. Why are empty catch block a bad idea?
150. What is difference between final, finally and finalize?
151. What happens when exception is thrown by main method?
152. Can subclass overriding method declare an exception if parent class
method doesn’t throw an exception?
153. What is collection framework?
154. What is exception propagation?
155. What will be output of below program?
12. Collection
156. What is collection framework?
157. What are benefits of collection framework?
158. What is difference between List and Set?
159. Explain Collection hierarchy.
160. What is difference between ArrayList and LinkedList?
161. What is difference between ArrayList and Vector?
162. What is difference between HashSet, LinkedHashSet and TreeSet?
163. What is difference between HashMap and HashTable?
164. What is load factor of ArrayList?
165. What are default capacities of collections?
166. What is difference between collections and collection?
167. What is iterator?
168. What is difference Iterator and Enumeration?
169. What are different ways to iterate over list?
170. How to remove duplicates from ArrayList?
171. How HashMap works internally?
172. How to iterate over HashMap?
173. How TreeMap works in Java?
174. What is difference between HashMap and TreeMap?
175. How ConcurrentHashMap works?
176. What is Generic? What are its advantages?
177. What are concurrent collections?
178. Implement ArrayList using Array.
13. Multithreading
179. What is multithreading?
180. What is thread?
181. What is context switching?
182. What is difference between process and thread?
183. What is difference between ‘extends Thread’ and ‘implements
Runnable’?
184. Explain Thread life cycle.
185. Which method is executed by thread by default?
186. Why can’t we start thread twice?
187. Why do we set thread priorities as there is no guarantee by which a
thread will be executed?
188. What is synchronized method and synchronized block? Which is more
preferred?
189. What is daemon thread?
190. Why wait(), notify() and notifyAll() must be called from synchronized
block or method?
191. What is volatile keyword?
192. What is thread local?
193. What is Thread dump?
194. What is deadlock?
195. What is Thread pool?
196. Why Thread.destroy() and Thread.stop(Throwable) methods are
removed in Java 11?
14. JDBC
197. What is JDBC?
198. What is JDBC driver?
199. What is JDBC DriverManager?
200. Write JDBC program to select data from table.
201. What are the types of JDBC Statements available?
202. What are the advantages of PreparedStatement over Statement?
203. What is ResultSet?
204. What is scrollable resultset?
205. What is BLOB?
206. What is CLOB?
207. How to turn off auto commit in JDBC?
208. What is difference between execute, executeQuery and
executeUpdate?
15. Version wise features
209. What are important features introduced in Java 5?
210. What is for-each loop introduced in Java 5?
211. What is Varargs introduced in Java 5?
212. What is static import?
213. What is Autoboxing and Unboxing?
214. What is Enum?
215. What is Covariant return type introduced in Java 5?
216. What is generics in Java 5?
217. What are new features introduced in Java 6?
218. What is premain method introduced in Java 6?
219. What are new features introduced in Java 7?
220. What is String in switch statement in Java 7?
221. What is binary literals in Java 7?
222. What is try with resources in Java 7?
223. Explain catching multiple exception with single catch in Java 7.
224. Explain underscore in numeric literals in Java 7?
225. What are new features introduced in Java 8?
226. What are lambda expressions introduced in Java 8?
227. What is stream API introduced in Java 8?
228. What are date time improvements in Java 8?
229. What is functional interface introduced Java 8?
230. What is default method introduced in Java 8?
231. What is method reference in Java 8?
232. What is forEach method in Java 8?
233. What is Collectors introduced in Java 8?
234. What is StringJoiner introduced in Java 8?
235. What is Optional Class introduced in Java 8?
236. What is Nashhorn introduced in Java 8?
237. What are new features introduced in Java 9?
238. What is java platform module system introduced in Java 9?
239. What is JShell introduced in Java 9?
240. What is private interface methods in Java 9?
241. What is New version string scheme in Java 9?
242. What are stream API improvements in Java 9?
243. What is improved Javadoc feature in Java 9?
244. What are new features introduced in Java 10?
245. What is Local-Variable Type Inference introduced in Java 10?
246. What is Time-Based Release Versioning introduced in java 10?
247. What is Garbage collector interface introduced in Java 10?
248. What is Parallel Full GC for G1 in Java 10?
249. What is significance of Root Certificates introduced in Java 10?
250. What is bytecode Generation for Enhanced for Loop in Java 10?
251. What are new features introduced in Java 11?
252. What are new String methods introduced in Java 11?
253. What are new file methods introduced in Java 11?
254. What is TimeUnit conversation method in Java 11?
255. What is local variable syntax for lambda parameters in Java 11?
256. What is Epsilon Garbage Collector introduced in Java 11?
257. Why Thread.destroy() and Thread.stop(Throwable) methods are
removed in Java 11?
258. What are new features introduced in Java 12?
259. What is Switch expression in Java 12?
260. What JVM improvements are done through default CDS Archives in
Java 12?
261. What is Shenandoah in Java 12?
262. What are Strings new methods introduced in Java 12?
263. What does support for Unicode 11 in Java 12 signify?
264. What does Support for Compact Number Formatting in Java 12
signify?
265. What are teeing collectors in Java 12?
16. Design Pattern
266. What are different categories of Java design pattern?
267. Explain Singleton design pattern.
268. In how many ways object is initialized in singleton design pattern?
269. Write program for singleton design pattern.
270. Explain factory design pattern.
271. Explain abstract factory design pattern.
272. Explain Prototype design pattern.
273. Explain builder design pattern.
274. Explain Adapter design pattern.
275. Explain Bridge design pattern.
276. Explain composite design pattern.
277. Explain Decorator Design Pattern.
278. Write Program for Decorator Design pattern.
279. Draw UML diagram for decorator design pattern.
280. Explain facade design pattern.
281. Explain flyweight design pattern.
282. Explain Proxy design pattern.
283. Explain Chain of responsibility design pattern.
284. Explain Command design pattern.
285. Draw UML for Command design pattern.
286. Write Program for command design pattern.
287. Explain Interpreter design pattern.
288. Explain Iterator design pattern.
289. Explain Mediator design pattern.
290. Explain Observer design pattern.
291. Explain Strategy design pattern.
292. Explain Template method design pattern.
293. Explain Visitor design pattern.
17. Hibernate
294. What is Hibernate?
295. Explain hibernate architecture.
296. What is ORM?
297. What is JPA?
298. What is SessionFactory?
299. What is Session?
300. What is Transaction?
301. What is difference between save() and persist()?
302. What is difference between get() and load()?
303. What is difference between update and merge method?
304. Select Query example in hibernate.
305. What are the states of object in hibernate?
306. Update Query example in hibernate.
307. What are inheritance mapping strategies in hibernate?
18. Spring
308. What is Spring?
304. Explain the modules of spring framework.
305. Explain advantages of spring framework?
304. What is IOC?
305. What is dependency Injection?
306. What is IoC container in Spring?
307. What are the known implementations of the ApplicationContext?
308. What is @Bean annotation?
309. What is @Configuration annotation?
310. What is @ComponentScan annotation?
311. What is autowiring in Spring?
312. What is @Autowired annotation?
313. What are the different bean scopes in spring?
314. What is AOP?
315. What is Aspect?
316. What is JoinPoint?
317. What is Advice?
318. Explain types of Advice.
319. What is Pointcut?
320. Explain Spring MVC framework flow.
321. What is @ResponceBody annotation?
322. What is @RequestBody annotation?
323. What is @RestController annotation?
324. What is @RequestHeader annotation?
325. How exception is handled in Spring?
19. Web Services
326. What is web service?
327. What are advantages of web services?
328. What are different types of web services?
329. What is difference between SOAP and REST web services?
330. What is difference between the Accept and Content-Type HTTP
headers?
331. What is @Controller annotation?
332. What is @RequestMapping annotation?
333. What is @RequestParam annotation?
334. What is @PathVariable?
335. What are different HTTP methods?
336. What is difference between GET and POST?
337. What is difference between PUT and POST?
338. What is difference between PUT and PATCH?
339. What is JAX-RS?
340. What are important annotations used in JAX-RS?
341. What are important HTTP status codes?
20. Spring Boot
342. What is Spring Boot?
343. What is an embedded server in Spring Boot?
344. How to switch from default embedded server in Spring Boot?
345. How to change port number of Spring Boot application?
346. What is starter POM?
347. What is auto configuration?
348. What is Spring Boot actuator?
349. What is Spring Boot initializer?
350. What is Spring Boot CLI?
351. How do you connect to database in your Spring Boot project?
352. Is it mandatory to use @SpringBootApplication annotation to create
spring boot application?
353. @SpringBootApplication annotation is combination of which
annotations?
21. Programs
354. Write a program to print fibonacci series program.
355. Write a program to check if String is palindrome.
356. Write a program to check if integer is palindrome.
357. Write a program to find factorial of number.
1. Fundamentals
1. What is Java?
The Java programming language is a high-level language, high level
programming language means it has strong abstraction from computer.
It is characterized as Simple, Object oriented, Distributed, Multithreaded,
Dynamic, Architecture neutral, Portable, High performance, Robust and
Secure.
Java can also be thought of as a software platform which runs on different
hardware platforms.
3. What is JDK?
Java development kit is abbreviated as JDK.
It is software development environment.
The JDK provides tools useful for developing and testing programs
written in the Java programming language and running on the Java
platform.
It is combination of Java Runtime Environment (JRE), an
interpreter/loader (Java), a compiler (javac), an archiver (jar), a document
generator (Javadoc) and other tools.
6. What is JVM?
Java virtual machine is abbreviated as JVM. JVM is composed of Class
Loader Subsystem, Runtime Data Area, and Execution Engine.
Class Loader Subsystem: It is used for loading, linking and initializing
.class file.
Loading: This component loads .class file. Bootstrap class loader,
extension class loader and application class loader are the different class
loaders.
Bootstrap class loader: Bootstrap class loader loads class file from
bootstrap class path i.e. rt.jar.
Extension class loader: Extension class loader loads class file from which
are inside the ext folder (jre\lib).
Application class loader: Application class loader loads class file from
Application classpath (class path mentioned in environment variable).
Linking: Linking phase has below steps,
Verify: It verifies bytecode, if verification fails you will get the
verification error.
Prepare: Memory allocation to all static variables is done, also static
variables assigned with default values.
Resolve: Symbolic memory references are replaced with the original
references from Method Area.
Initialization: This component performs the final phase of the class
loading where all the static variables are assigned the original values and
the static blocks are executed from the parent to the child class.
Runtime Data Area:
Runtime Data Area has below components,
Heap: Objects, instance variables and arrays will be stored here. There is
also one Heap per JVM. Heap areas is shared by multiple threads hence
the data stored is not thread-safe.
Stack Area: For every thread, one runtime stack will be created. For each
method call entry is made in the stack area which is called as Stack Frame.
Stack memory contains all local variables. The stack area is not shared by
multiple thread hence it is thread safe.
Method Area: Class level data is stored in method area, including static
variables. Every JVM has only one method area.
Native Method stacks: This component is written in a different language
and holds the native method information.
PC Registers: This component holds the address of the JVM instruction
which is currently executing. Each thread in Java has its own PC register
to hold the address of the currently executing instruction.
Execution Engine:
Bytecode is executed by execution engine.
It has components like interpreter, JIT compiler and garbage collector.
The interpreter interprets the bytecode, when one method is called
multiple times, every time a new interpretation is required.
When execution engine finds repeated code it uses the JIT compiler,
which compiles the entire bytecode and changes it to native code.
Repeated method calls will use this native code, which improve the
performance of the system.
Garbage collector Collects and removes unreferenced objects.
Java Native Interface (JNI): JNI interacts with the Native Method
Libraries and provide required native libraries to the Execution Engine.
Native Method Libraries: Native Method Libraries are required for the
Execution Engine.
Encapsulation
Data Abstraction
Polymorphism
Inheritance
25. What does public static void main (String args[]) signify?
Here, main is name of the method.
Public access modifier means main method can be accessed by any class.
Static means method can be accessed without creating an instance of the
class.
Void means method does not return anything.
String args[] specifies parameters passed to the method.
If you try to instantiate D from any other class, you will get
java.lang.StackOverflowError
Newly created object is allocated memory on the Eden space. Eden space
is inspected by garbage collector to marks objects as which are alive.
Alive objects after a garbage collecting process are moved into a survivor
space S0. The second time the garbage collector runs on the Eden space, it
moves all alive marked objects into the S1 space. Also, everything that is
currently on S0 is moved into the S1 space.
If an object survives for X rounds of garbage collection, it is most likely
that it will survive forever, and it gets moved into the Old space.
The old memory can be also garbage collected, but since it is a bigger part
of the memory compared to Eden space, it does not happen that often.
44. How many objects are eligible for garbage collection, after
line 8 runs?
public class X {
public static void main(String [] args) {
X x = new X();
X x2 = m1(x); /* Line 6 */
X x4 = new X();
x2 = x4; /* Line 8 */
doComplexStuff();
}
static X m1(X mx) {
mx = new X();
return mx;
}
}
String.transform():
The transform() method takes a String and transforms it into a new String
with the help of a Function.
e.g.
var result = "Hello".transform(s -> s + ", World!");
System.out.println(result); // Hello, World!
76. Can you remove static modifier from the signature of the
main method?
Static modifier can be removed from signature of main method Program
compiles.
However, at runtime, it throws an error "NoSuchMethodError."
Single-level inheritance
Multi-level inheritance
Multiple Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Output:
10
7. Polymorphism
95. What does Polymorphism mean?
Polymorphism is ability of a variable, function or object to take on
multiple forms.
Output:
ONE
8. Abstract Classes and Interfaces
108. What is abstraction?
Abstraction is a process of hiding unnecessary information and showing
only what is essential to the end user.
For example, when you want to turn on television you just turn on the
switch and you don’t actually know the internal working of how television
started.
125. For every interface written in a java file, .class file will be
generated after compilation? True or False?
True. The .class file will be generated for every interface after
compilation.
No. It gives compile time error. While overriding Compiler treats int and
Integer as two different types. Auto-boxing doesn’t happen here.
Output:
exception caught
finally block executing
from catch
12. Collection
154. What is collection framework?
The Java Collections Framework is a collection of interfaces and classes
which helps in storing and manipulating group of objects.
ArrayList increases its size by 50% Vector increases its size by 100%
when elements exceeds its capacity. which doubles its size when
elements exceeds its capacity.
ArrayList = 10
Vector = 10
HashSet = 16
HashMap = 16
Hashtable = 11
HashSet =16
When node is inserted tree formation happens in such a way that left
element is always less that parent element and right element will always
be greater than or equal to parent element.
HashMap allows storing one null TreeMap doesn’t allow storing null
key and many null values. key but allows storing many null
values.
For-each loop
Varargs
Static import
Autoboxing and unboxing
Enum
Covariant return type
Annotations
Generics
The three periods after the final parameter's type specify that the final
argument may be passed as an array or as a sequence of arguments.
Premain method
Lambda expression
Stream
Java 8 Date/time
Functional Interface
Default methods
Method references
forEach method
Collectors
StringJoiner
Optional Class
Nashhorn
Switch expressions
Default CDS archives
Shenandoah
Strings New Methods
JVM constants API
Support for Unicode 11
Support for Compact Number Formatting
Teeing Collectors
class RemoteControl
{
Command command;
public RemoteControl()
{
}
public void setCommand(Command command)
{
this.command = command;
}
public void buttonWasPressed()
{
this.command.execute();
}
}
// Driver class
class RemoteControlTest
{
public static void main(String[] args)
{
RemoteControl remote = new RemoteControl();
Television television = new Television();
remote.setCommand(new
TurnTVOn(television));
remote.buttonWasPressed();
}
}
Configuration
The Configuration object reads properties Hibernate uses to get connected
to a database and configure itself for work.
SessionFactory
The SessionFactory is obtained from a Configuration object. It is factory
of Session objects. One SessionFactory object is created per database. For
connection with multiple database multiple SessionFactory objects are
created with different configurations. The SessionFactory provide second
level caching. It is a thread safe object.
Session
Session maintains connection between application and database. It
provides methods like load(), get(), save(), persist(), update() using which
you can store, manipulate data from database. It is factory of Query,
Criteria and Transaction. Session Object is not thread safe. Multiple
threads can access it.
Transaction
It represents unit of works.
Query and Criteria
These objects are used to retrieve (and recreate) persistent objects.
The get() method hits the database The load() method doesn’t hit the
and returns real object. database and returns proxy object.
The get() method should be used if The load() method should be used
you are not sure about the existence if you are sure about existence of
of object. object.
Core Container
The Core Container comprises of the Beans, Core, Context, and
Expression Language modules.
The Core and Beans modules enable IoC and Dependency Injection
features.
Context is responsible for initializing, configuring the instance and
assembling the dependencies.
The Expression Language module provides a powerful expression
language which is used for method invocation of bean, bean injection.
Expression language also supports regular expression, mathematical,
relational, logical, conditional operators.
Data Access/Integration
JDBC, ORM, OXM, JMS and Transaction modules are part of The Data
Access/Integration layer.
The JDBC module removes the need to do redundant JDBC coding.
The ORM module integrates with popular object-relational mapping APIs
such as JPA, Hibernate and more.
The OXM module provides supports for Object/XML mapping
implementations like JAXB, XStream and more.
The Java Messaging Service (JMS) module is used for producing and
consuming messages.
The Transaction module is used for programmatic and declarative
transaction management.
Web
Web, Web-Servlet, WebSocket and Web-Portlet modules are part of Web
layer.
Web module provides basic web integration features.
The Web-Servlet module consists of model-view-controller (MVC)
implementation which is used in web applications.
AOP
AOP module provides aspect-oriented programming implementation
which divides program into aspects which increases modularity of
program.
Aspect is a class which is used across multiple classes for particular
requirement. For example, Logging aspect can be a class which is used
across multiple classes for logging.
Test
The Test module supports the testing using JUnit or TestNG.
It provides capability to load Spring ApplicationContexts and cache those
contexts.
It also provides mock objects that can be used to test the code.
After exclusion you can add new dependency of application server that
you want to include as below:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-
jetty</artifactId>
</dependency>
spring-boot-starter
jackson
spring-core
spring-mvc
spring-boot-starter-tomcat
Create Repository.
Create entity class that is mapped to database table.